From 5bdd15f7468a2319a3370850d966458e0936b232 Mon Sep 17 00:00:00 2001 From: Samuel Cattini-Schultz Date: Mon, 5 Apr 2021 22:14:37 +1000 Subject: [PATCH] Refactor Skill.Process() to not require calling base.Process() --- osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs | 2 +- osu.Game/Rulesets/Difficulty/Skills/Skill.cs | 11 +++++++---- osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs | 4 +--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index 14ada8ca09..5780fe39fa 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Difficulty { foreach (var skill in skills) { - skill.Process(hitObject); + skill.ProcessInternal(hitObject); } } diff --git a/osu.Game/Rulesets/Difficulty/Skills/Skill.cs b/osu.Game/Rulesets/Difficulty/Skills/Skill.cs index b317c140d8..534dee3ba8 100644 --- a/osu.Game/Rulesets/Difficulty/Skills/Skill.cs +++ b/osu.Game/Rulesets/Difficulty/Skills/Skill.cs @@ -30,14 +30,17 @@ namespace osu.Game.Rulesets.Difficulty.Skills this.mods = mods; } + internal void ProcessInternal(DifficultyHitObject current) + { + Process(current); + Previous.Push(current); + } + /// /// Process a . /// /// The to process. - public virtual void Process(DifficultyHitObject current) - { - Previous.Push(current); - } + protected abstract void Process(DifficultyHitObject current); /// /// Returns the calculated difficulty value representing all s that have been processed up to this point. diff --git a/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs b/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs index c324f8e414..71cee36812 100644 --- a/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs +++ b/osu.Game/Rulesets/Difficulty/Skills/StrainSkill.cs @@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Difficulty.Skills /// /// Process a and update current strain values accordingly. /// - public sealed override void Process(DifficultyHitObject current) + protected sealed override void Process(DifficultyHitObject current) { // The first object doesn't generate a strain, so we begin with an incremented section end if (Previous.Count == 0) @@ -72,8 +72,6 @@ namespace osu.Game.Rulesets.Difficulty.Skills CurrentStrain += StrainValueOf(current) * SkillMultiplier; currentSectionPeak = Math.Max(CurrentStrain, currentSectionPeak); - - base.Process(current); } ///