diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs
index 03c1f0468c..0986931d00 100644
--- a/osu.Game/Overlays/Mods/ModSection.cs
+++ b/osu.Game/Overlays/Mods/ModSection.cs
@@ -114,19 +114,19 @@ namespace osu.Game.Overlays.Mods
}
///
- /// Select one or more mods in this section.
+ /// Select one or more mods in this section and deselects all other ones.
///
- /// The types of s which should be deselected.
- public void SelectTypes(IEnumerable mods)
+ /// The types of s which should be selected.
+ public void SelectTypes(IEnumerable modTypes)
{
foreach (var button in buttons)
{
- for (int i = 0; i < button.Mods.Length; i++)
- {
- foreach (var mod in mods)
- if (mod.GetType().IsInstanceOfType(button.Mods[i]))
- button.SelectAt(i);
- }
+ int i = Array.FindIndex(button.Mods, m => modTypes.Any(t => t.IsInstanceOfType(m)));
+
+ if (i >= 0)
+ button.SelectAt(i);
+ else
+ button.Deselect();
}
}
diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs
index d0a507be98..cc4b354fa2 100644
--- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs
+++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs
@@ -76,7 +76,7 @@ namespace osu.Game.Overlays.Mods
private void selectedModsChanged(IEnumerable obj)
{
foreach (ModSection section in ModSectionsContainer.Children)
- section.SelectTypes(obj);
+ section.SelectTypes(obj.Select(m => m.GetType()).ToList());
updateMods();
}