mirror of
https://github.com/ppy/osu
synced 2025-04-04 23:29:56 +00:00
Fix div-by-0 when 0 ticks are hit
This commit is contained in:
parent
321ca43b61
commit
4a391ce03d
@ -263,16 +263,20 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
int totalTicks = NestedHitObjects.Count;
|
int totalTicks = NestedHitObjects.Count;
|
||||||
int hitTicks = NestedHitObjects.Count(h => h.IsHit);
|
int hitTicks = NestedHitObjects.Count(h => h.IsHit);
|
||||||
double hitFraction = (double)totalTicks / hitTicks;
|
|
||||||
|
|
||||||
if (hitTicks == totalTicks)
|
if (hitTicks == totalTicks)
|
||||||
r.Type = HitResult.Great;
|
r.Type = HitResult.Great;
|
||||||
else if (hitFraction >= 0.5)
|
else if (hitTicks == 0)
|
||||||
|
r.Type = HitResult.Miss;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double hitFraction = (double)totalTicks / hitTicks;
|
||||||
|
|
||||||
|
if (hitFraction >= 0.5)
|
||||||
r.Type = HitResult.Ok;
|
r.Type = HitResult.Ok;
|
||||||
else if (hitFraction > 0)
|
else if (hitFraction > 0)
|
||||||
r.Type = HitResult.Meh;
|
r.Type = HitResult.Meh;
|
||||||
else
|
}
|
||||||
r.Type = HitResult.Miss;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user