mirror of
https://github.com/ppy/osu
synced 2025-01-18 20:10:49 +00:00
Merge pull request #7848 from smoogipoo/fix-match-subscreen-crashes
Replace hashcode override with local equality comparer
This commit is contained in:
commit
80462014d9
@ -179,6 +179,16 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddAssert("item 0 is selected", () => playlist.SelectedItem.Value == playlist.Items[0]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestChangeBeatmapAndRemove()
|
||||
{
|
||||
createPlaylist(true, true);
|
||||
|
||||
AddStep("change beatmap of first item", () => playlist.Items[0].BeatmapID = 30);
|
||||
moveToDeleteButton(0);
|
||||
AddStep("click delete button", () => InputManager.Click(MouseButton.Left));
|
||||
}
|
||||
|
||||
private void moveToItem(int index, Vector2? offset = null)
|
||||
=> AddStep($"move mouse to item {index}", () => InputManager.MoveMouseTo(playlist.ChildrenOfType<OsuRearrangeableListItem<PlaylistItem>>().ElementAt(index), offset));
|
||||
|
||||
|
@ -93,12 +93,5 @@ namespace osu.Game.Online.Multiplayer
|
||||
public bool ShouldSerializeapiBeatmap() => false;
|
||||
|
||||
public bool Equals(PlaylistItem other) => ID == other?.ID && BeatmapID == other.BeatmapID && RulesetID == other.RulesetID;
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
// ReSharper disable NonReadonlyMemberInGetHashCode
|
||||
return HashCode.Combine(ID, BeatmapID, RulesetID);
|
||||
// ReSharper restore NonReadonlyMemberInGetHashCode
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,19 +124,20 @@ namespace osu.Game.Online.Multiplayer
|
||||
var localItem = Playlist.FirstOrDefault(i => i.BeatmapID == item.BeatmapID);
|
||||
|
||||
if (localItem != null)
|
||||
{
|
||||
item.Beatmap.Value.Metadata = localItem.Beatmap.Value.Metadata;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var removeableItem in Playlist.Except(other.Playlist).ToArray())
|
||||
Playlist.Remove(removeableItem);
|
||||
if (!Playlist.SequenceEqual(other.Playlist))
|
||||
{
|
||||
Playlist.Clear();
|
||||
Playlist.AddRange(other.Playlist);
|
||||
}
|
||||
|
||||
Playlist.AddRange(other.Playlist.Except(Playlist).ToArray());
|
||||
|
||||
foreach (var removedItem in Participants.Except(other.Participants).ToArray())
|
||||
Participants.Remove(removedItem);
|
||||
Participants.AddRange(other.Participants.Except(Participants).ToArray());
|
||||
if (!Participants.SequenceEqual(other.Participants))
|
||||
{
|
||||
Participants.Clear();
|
||||
Participants.AddRange(other.Participants);
|
||||
}
|
||||
|
||||
Position = other.Position;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user