From ed296462911591152d0ec2f2fe558ab6edc62adb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 14 Jul 2021 12:32:14 +0900 Subject: [PATCH] Remove `IApplicableToDifficulty.ReadFromDifficulty` This was added specifically for `ModDifficultyAdjust`, but turned out to be more of a headache than we expected. We have since removed usage and would hope that this is not required by any other mods. Opting for complete removal rather than obsoletion, as we discovered this was already broken in multiple cases, with fixes being quite logically complex. If you happen to be a ruleset developer relying on this, open an issue and we'll talk you through a better approach (or check what `ModDifficultyAdjust` is doing now for an example). --- osu.Game/OsuGame.cs | 18 ------------------ .../Rulesets/Mods/IApplicableToDifficulty.cs | 7 ------- 2 files changed, 25 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index c25b520892..8119df43ac 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -525,16 +525,11 @@ public override Task Import(params ImportTask[] imports) private void beatmapChanged(ValueChangedEvent beatmap) { beatmap.OldValue?.CancelAsyncLoad(); - - updateModDefaults(); - beatmap.NewValue?.BeginAsyncLoad(); } private void modsChanged(ValueChangedEvent> mods) { - updateModDefaults(); - // a lease may be taken on the mods bindable, at which point we can't really ensure valid mods. if (SelectedMods.Disabled) return; @@ -546,19 +541,6 @@ private void modsChanged(ValueChangedEvent> mods) } } - private void updateModDefaults() - { - BeatmapDifficulty baseDifficulty = Beatmap.Value.BeatmapInfo.BaseDifficulty; - - if (baseDifficulty != null && SelectedMods.Value.Any(m => m is IApplicableToDifficulty)) - { - var adjustedDifficulty = baseDifficulty.Clone(); - - foreach (var mod in SelectedMods.Value.OfType()) - mod.ReadFromDifficulty(adjustedDifficulty); - } - } - #endregion private PerformFromMenuRunner performFromMainMenuTask; diff --git a/osu.Game/Rulesets/Mods/IApplicableToDifficulty.cs b/osu.Game/Rulesets/Mods/IApplicableToDifficulty.cs index 34198da722..42b520ab26 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToDifficulty.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToDifficulty.cs @@ -10,13 +10,6 @@ namespace osu.Game.Rulesets.Mods /// public interface IApplicableToDifficulty : IApplicableMod { - /// - /// Called when a beatmap is changed. Can be used to read default values. - /// Any changes made will not be preserved. - /// - /// The difficulty to read from. - void ReadFromDifficulty(BeatmapDifficulty difficulty); - /// /// Called post beatmap conversion. Can be used to apply changes to difficulty attributes. ///