From 2df519ddfad597931c038876ebebfaf7e1740dd1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 11 Oct 2019 14:01:36 +0900 Subject: [PATCH] Simplify colour retrieval function --- .../Edit/Compose/Components/BeatSnapGrid.cs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs index 957e752fa2..0630fc5099 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs @@ -125,20 +125,17 @@ namespace osu.Game.Screens.Edit.Compose.Components /// The applicable colour. protected ColourInfo GetColourForBeatIndex(int index) { - int divIndex = beatDivisor.Value - (index % beatDivisor.Value) - 1; - + int beat = (index + 1) % beatDivisor.Value; ColourInfo colour = colours.Gray5; + for (int i = 0; i < BindableBeatDivisor.VALID_DIVISORS.Length; i++) { - for (int i = 0; i < BindableBeatDivisor.VALID_DIVISORS.Length; i++) - { - int divisor = BindableBeatDivisor.VALID_DIVISORS[i]; + int divisor = BindableBeatDivisor.VALID_DIVISORS[i]; - if ((divIndex * divisor) % beatDivisor.Value == 0) - { - colour = BindableBeatDivisor.GetColourFor(divisor, colours); - break; - } + if ((beat * divisor) % beatDivisor.Value == 0) + { + colour = BindableBeatDivisor.GetColourFor(divisor, colours); + break; } }