mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Ensure one non-expired item when switching to host-only
This commit is contained in:
@ -387,8 +387,13 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
if (newMode == QueueModes.HostOnly)
|
if (newMode == QueueModes.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.
|
||||||
foreach (var playlistItem in playlistItems.Where(i => !i.Expired && i.ID != currentItem.ID).ToArray())
|
foreach (var playlistItem in playlistItems.Where(i => !i.Expired && i.ID != currentItem.ID).ToArray())
|
||||||
await ((IMultiplayerClient)this).PlaylistItemRemoved(playlistItem.ID).ConfigureAwait(false);
|
await ((IMultiplayerClient)this).PlaylistItemRemoved(playlistItem.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 modes, items could have been added (above) or the queueing order could have changed.
|
// When changing modes, items could have been added (above) or the queueing order could have changed.
|
||||||
|
Reference in New Issue
Block a user