Remove unnecessary contains checks

This commit is contained in:
Dean Herbert 2020-09-11 22:03:19 +09:00
parent 22e6df02b6
commit 94d929d8cd

View File

@ -145,16 +145,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <param name="blueprint">The blueprint.</param> /// <param name="blueprint">The blueprint.</param>
internal void HandleSelected(SelectionBlueprint blueprint) internal void HandleSelected(SelectionBlueprint blueprint)
{ {
if (!selectedBlueprints.Contains(blueprint)) selectedBlueprints.Add(blueprint);
{
selectedBlueprints.Add(blueprint);
// need to check this as well, as there are potentially multiple SelectionHandlers and the above check is not enough. // need to check this as well, as there are potentially multiple SelectionHandlers and the above check is not enough.
if (!EditorBeatmap.SelectedHitObjects.Contains(blueprint.HitObject)) if (!EditorBeatmap.SelectedHitObjects.Contains(blueprint.HitObject))
EditorBeatmap.SelectedHitObjects.Add(blueprint.HitObject); EditorBeatmap.SelectedHitObjects.Add(blueprint.HitObject);
UpdateVisibility(); UpdateVisibility();
}
} }
/// <summary> /// <summary>
@ -163,12 +160,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <param name="blueprint">The blueprint.</param> /// <param name="blueprint">The blueprint.</param>
internal void HandleDeselected(SelectionBlueprint blueprint) internal void HandleDeselected(SelectionBlueprint blueprint)
{ {
if (selectedBlueprints.Remove(blueprint)) EditorBeatmap.SelectedHitObjects.Remove(blueprint.HitObject);
{
EditorBeatmap.SelectedHitObjects.Remove(blueprint.HitObject);
UpdateVisibility(); UpdateVisibility();
}
} }
/// <summary> /// <summary>