Use while loops instead

This commit is contained in:
iiSaLMaN 2019-07-27 15:52:01 +03:00
parent 46f17885c6
commit 6c580ac9d5

View File

@ -158,15 +158,13 @@ namespace osu.Game.Screens.Play
if (time > breaks[currentBreakIndex].EndTime) if (time > breaks[currentBreakIndex].EndTime)
{ {
for (; currentBreakIndex < breaks.Count; currentBreakIndex++) while (time > breaks[currentBreakIndex].EndTime && currentBreakIndex < breaks.Count - 1)
if (time <= breaks[currentBreakIndex].EndTime) currentBreakIndex++;
break;
} }
else if (time < breaks[currentBreakIndex].StartTime) else if (time < breaks[currentBreakIndex].StartTime)
{ {
for (; currentBreakIndex >= 0; currentBreakIndex--) while (time < breaks[currentBreakIndex].StartTime && currentBreakIndex > 0)
if (time >= breaks[currentBreakIndex].StartTime) currentBreakIndex--;
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.