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

Modify global index directly in the for loop

Moves the global index to a near break if not in a break yet
This commit is contained in:
iiSaLMaN 2019-07-26 09:24:53 +03:00
parent 5a94a22314
commit 4c9e8527d8

View File

@ -158,25 +158,15 @@ namespace osu.Game.Screens.Play
if (time > breaks[currentBreakIndex].EndTime) if (time > breaks[currentBreakIndex].EndTime)
{ {
for (int i = currentBreakIndex; i < breaks.Count; i++) for (; currentBreakIndex < breaks.Count; currentBreakIndex++)
{ if (time <= breaks[currentBreakIndex].EndTime)
if (time <= breaks[i].EndTime)
{
currentBreakIndex = i;
break; break;
}
}
} }
else if (time < breaks[currentBreakIndex].StartTime) else if (time < breaks[currentBreakIndex].StartTime)
{ {
for (int i = currentBreakIndex; i >= 0; i--) for (; currentBreakIndex >= 0; currentBreakIndex--)
{ if (time >= breaks[currentBreakIndex].StartTime)
if (time >= breaks[i].StartTime)
{
currentBreakIndex = i;
break; break;
}
}
} }
// This ensures that IsBreakTime is generally consistent with the overlay's transforms during a break. // This ensures that IsBreakTime is generally consistent with the overlay's transforms during a break.