From 642097166033bbcce457b09668e5c6fcdd51d5ce Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 22 Nov 2021 11:10:08 +0900 Subject: [PATCH] Adjust test client with new queue-changing logic --- .../Multiplayer/TestMultiplayerClient.cs | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs index 4deeef331d..20226bdb4f 100644 --- a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs +++ b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs @@ -370,25 +370,9 @@ namespace osu.Game.Tests.Visual.Multiplayer Debug.Assert(APIRoom != null); Debug.Assert(currentItem != null); - if (newMode == QueueMode.HostOnly) - { - // Remove all but the current and expired items. The current item may be re-used for host-only mode if it's non-expired. - for (int i = 0; i < Room.Playlist.Count; i++) - { - var item = Room.Playlist[i]; - - if (item.Expired || item.ID == Room.Settings.PlaylistItemId) - continue; - - Room.Playlist.RemoveAt(i--); - - await ((IMultiplayerClient)this).PlaylistItemRemoved(item.ID).ConfigureAwait(false); - } - - // Always ensure that at least one non-expired item exists by duplicating the current item if required. - if (currentItem.Expired) - await duplicateCurrentItem().ConfigureAwait(false); - } + // When changing to host-only mode, ensure that at least one non-expired playlist item exists by duplicating the current item. + if (newMode == QueueMode.HostOnly && Room.Playlist.All(item => item.Expired)) + await duplicateCurrentItem().ConfigureAwait(false); // When changing modes, items could have been added (above) or the queueing order could have changed. await updateCurrentItem(Room).ConfigureAwait(false);