diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIconTooltip.cs b/osu.Game/Beatmaps/Drawables/DifficultyIconTooltip.cs index a5cac69afd..36ddb6030e 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIconTooltip.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIconTooltip.cs @@ -124,7 +124,9 @@ public void SetContent(DifficultyIconTooltipContent content) difficultyFillFlowContainer.Show(); miscFillFlowContainer.Show(); - double rate = ModUtils.CalculateRateWithMods(displayedContent.Mods); + double rate = 1; + if (displayedContent.Mods != null) + rate = ModUtils.CalculateRateWithMods(displayedContent.Mods); double bpmAdjusted = displayedContent.BeatmapInfo.BPM * rate; diff --git a/osu.Game/Online/Rooms/PlaylistExtensions.cs b/osu.Game/Online/Rooms/PlaylistExtensions.cs index 4bcaaa8131..003fd23d40 100644 --- a/osu.Game/Online/Rooms/PlaylistExtensions.cs +++ b/osu.Game/Online/Rooms/PlaylistExtensions.cs @@ -1,13 +1,11 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Collections.Generic; using System.Linq; using Humanizer; using Humanizer.Localisation; using osu.Framework.Bindables; -using osu.Game.Rulesets.Mods; using osu.Game.Utils; namespace osu.Game.Online.Rooms @@ -48,7 +46,7 @@ public static string GetTotalDuration(this BindableList playlist) playlist.Select(p => { var ruleset = p.Beatmap.Ruleset.CreateInstance(); - double rate = ModUtils.CalculateRateWithMods(p.RequiredMods.Select(mod => mod.ToMod(ruleset)).ToList()); + double rate = ModUtils.CalculateRateWithMods(p.RequiredMods.Select(mod => mod.ToMod(ruleset))); return p.Beatmap.Length / rate; }).Sum().Milliseconds().Humanize(minUnit: TimeUnit.Second, maxUnit: TimeUnit.Hour, precision: 2); } diff --git a/osu.Game/Overlays/Mods/BeatmapAttributesDisplay.cs b/osu.Game/Overlays/Mods/BeatmapAttributesDisplay.cs index b625de27f8..1f4e007f47 100644 --- a/osu.Game/Overlays/Mods/BeatmapAttributesDisplay.cs +++ b/osu.Game/Overlays/Mods/BeatmapAttributesDisplay.cs @@ -165,7 +165,7 @@ private void updateValues() => Scheduler.AddOnce(() => starRatingDisplay.FinishTransforms(true); }); - double rate = ModUtils.CalculateRateWithMods(Mods.Value.ToList()); + double rate = ModUtils.CalculateRateWithMods(Mods.Value); bpmDisplay.Current.Value = FormatUtils.RoundBPM(BeatmapInfo.Value.BPM, rate); diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 0e2d1db6b7..02682c1851 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -402,7 +402,7 @@ private void refreshBPMAndLengthLabel() return; // this doesn't consider mods which apply variable rates, yet. - double rate = ModUtils.CalculateRateWithMods(mods.Value.ToList()); + double rate = ModUtils.CalculateRateWithMods(mods.Value); int bpmMax = FormatUtils.RoundBPM(beatmap.ControlPointInfo.BPMMaximum, rate); int bpmMin = FormatUtils.RoundBPM(beatmap.ControlPointInfo.BPMMinimum, rate); diff --git a/osu.Game/Utils/ModUtils.cs b/osu.Game/Utils/ModUtils.cs index 3378e94ec0..f901f15388 100644 --- a/osu.Game/Utils/ModUtils.cs +++ b/osu.Game/Utils/ModUtils.cs @@ -285,11 +285,10 @@ public static LocalisableString FormatScoreMultiplier(double scoreMultiplier) public static double CalculateRateWithMods(IEnumerable mods) { double rate = 1; - if (mods != null) - { - foreach (var mod in mods.OfType()) - rate = mod.ApplyToRate(0, rate); - } + + foreach (var mod in mods.OfType()) + rate = mod.ApplyToRate(0, rate); + return rate; } }