1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 23:05:37 +08:00

Fix div-by-0 when 0 ticks are hit

This commit is contained in:
smoogipoo 2021-02-10 21:24:41 +09:00
parent 321ca43b61
commit 4a391ce03d

View File

@ -263,16 +263,20 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
int totalTicks = NestedHitObjects.Count;
int hitTicks = NestedHitObjects.Count(h => h.IsHit);
double hitFraction = (double)totalTicks / hitTicks;
if (hitTicks == totalTicks)
r.Type = HitResult.Great;
else if (hitFraction >= 0.5)
r.Type = HitResult.Ok;
else if (hitFraction > 0)
r.Type = HitResult.Meh;
else
else if (hitTicks == 0)
r.Type = HitResult.Miss;
else
{
double hitFraction = (double)totalTicks / hitTicks;
if (hitFraction >= 0.5)
r.Type = HitResult.Ok;
else if (hitFraction > 0)
r.Type = HitResult.Meh;
}
});
}