1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 08:43:21 +08:00

Fix float division

Firstly, this is intended to be a float division.

Secondly, dividing integers by 0 results in an exception, but dividing
non-zero floats by 0 results in +/- infinity which will be clamped to
the upper range.
In particular, this occurs when the beatmap has 1 hitobject (0 drain
length).
This commit is contained in:
Dan Balasescu 2023-06-27 16:47:42 +09:00
parent 0c5c09597c
commit 5f350aa66f
3 changed files with 3 additions and 3 deletions

View File

@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty
(baseBeatmap.Difficulty.DrainRate
+ baseBeatmap.Difficulty.OverallDifficulty
+ baseBeatmap.Difficulty.CircleSize
+ Math.Clamp(objectCount / drainLength * 8, 0, 16)) / 38 * 5);
+ Math.Clamp((float)objectCount / drainLength * 8, 0, 16)) / 38 * 5);
scoreMultiplier = difficultyPeppyStars * mods.Aggregate(1.0, (current, mod) => current * mod.ScoreMultiplier);

View File

@ -81,7 +81,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
(baseBeatmap.Difficulty.DrainRate
+ baseBeatmap.Difficulty.OverallDifficulty
+ baseBeatmap.Difficulty.CircleSize
+ Math.Clamp(objectCount / drainLength * 8, 0, 16)) / 38 * 5);
+ Math.Clamp((float)objectCount / drainLength * 8, 0, 16)) / 38 * 5);
scoreMultiplier = difficultyPeppyStars * mods.Aggregate(1.0, (current, mod) => current * mod.ScoreMultiplier);

View File

@ -84,7 +84,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
(baseBeatmap.Difficulty.DrainRate
+ baseBeatmap.Difficulty.OverallDifficulty
+ baseBeatmap.Difficulty.CircleSize
+ Math.Clamp(objectCount / drainLength * 8, 0, 16)) / 38 * 5);
+ Math.Clamp((float)objectCount / drainLength * 8, 0, 16)) / 38 * 5);
modMultiplier = mods.Aggregate(1.0, (current, mod) => current * mod.ScoreMultiplier);