1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 04:42:58 +08:00

Transfer metadata to ensure present on creating a new match

This commit is contained in:
Dean Herbert 2020-02-15 19:40:59 +09:00
parent 2e24ceb223
commit d0122b935e

View File

@ -118,8 +118,20 @@ namespace osu.Game.Online.Multiplayer
if (DateTimeOffset.Now >= EndDate.Value)
Status.Value = new RoomStatusEnded();
foreach (var removedItem in Playlist.Except(other.Playlist).ToArray())
Playlist.Remove(removedItem);
// transfer local beatmaps across to ensure we have Metadata available (CreateRoomRequest does not give us metadata as expected)
foreach (var item in other.Playlist)
{
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);
Playlist.AddRange(other.Playlist.Except(Playlist).ToArray());
foreach (var removedItem in Participants.Except(other.Participants).ToArray())