1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 05:42:56 +08:00

Fix song select potentially displaying BPM range with equal min/max values

This commit is contained in:
Salman Ahmed 2022-05-20 17:43:40 +03:00
parent de8aedf348
commit 596853da8f

View File

@ -12,7 +12,6 @@ using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics;
@ -416,13 +415,13 @@ namespace osu.Game.Screens.Select
foreach (var mod in mods.Value.OfType<IApplicableToRate>())
rate = mod.ApplyToRate(0, rate);
double bpmMax = beatmap.ControlPointInfo.BPMMaximum * rate;
double bpmMin = beatmap.ControlPointInfo.BPMMinimum * rate;
double mostCommonBPM = 60000 / beatmap.GetMostCommonBeatLength() * rate;
int bpmMax = (int)Math.Round(beatmap.ControlPointInfo.BPMMaximum * rate);
int bpmMin = (int)Math.Round(beatmap.ControlPointInfo.BPMMinimum * rate);
int mostCommonBPM = (int)Math.Round(60000 / beatmap.GetMostCommonBeatLength() * rate);
string labelText = Precision.AlmostEquals(bpmMin, bpmMax)
? $"{bpmMin:0}"
: $"{bpmMin:0}-{bpmMax:0} (mostly {mostCommonBPM:0})";
string labelText = bpmMin == bpmMax
? $"{bpmMin}"
: $"{bpmMin}-{bpmMax} (mostly {mostCommonBPM})";
bpmLabelContainer.Child = new InfoLabel(new BeatmapStatistic
{