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:
parent
321ca43b61
commit
4a391ce03d
@ -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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user