diff --git a/osu.Game/Screens/OnlinePlay/Components/RoomManager.cs b/osu.Game/Screens/OnlinePlay/Components/RoomManager.cs
index ab92adcac7..43bf3a2ce5 100644
--- a/osu.Game/Screens/OnlinePlay/Components/RoomManager.cs
+++ b/osu.Game/Screens/OnlinePlay/Components/RoomManager.cs
@@ -57,11 +57,10 @@ namespace osu.Game.Screens.OnlinePlay.Components
{
joinedRoom.Value = room;
- update(room, result);
- addRoom(room);
+ AddOrUpdateRoom(result);
+ room.CopyFrom(result); // Also copy back to the source model, since this is likely to have been stored elsewhere.
- RoomsUpdated?.Invoke();
- onSuccess?.Invoke(room);
+ onSuccess?.Invoke(result);
};
req.Failure += exception =>
@@ -119,8 +118,14 @@ namespace osu.Game.Screens.OnlinePlay.Components
try
{
- update(room, room);
- addRoom(room);
+ foreach (var pi in room.Playlist)
+ pi.MapObjects(beatmaps, rulesets);
+
+ var existing = rooms.FirstOrDefault(e => e.RoomID.Value == room.RoomID.Value);
+ if (existing == null)
+ rooms.Add(room);
+ else
+ existing.CopyFrom(room);
}
catch (Exception ex)
{
@@ -145,32 +150,6 @@ namespace osu.Game.Screens.OnlinePlay.Components
notifyRoomsUpdated();
}
- ///
- /// Updates a local with a remote copy.
- ///
- /// The local to update.
- /// The remote to update with.
- private void update(Room local, Room remote)
- {
- foreach (var pi in remote.Playlist)
- pi.MapObjects(beatmaps, rulesets);
-
- local.CopyFrom(remote);
- }
-
- ///
- /// Adds a to the list of available rooms.
- ///
- /// The to add.
- private void addRoom(Room room)
- {
- var existing = rooms.FirstOrDefault(e => e.RoomID.Value == room.RoomID.Value);
- if (existing == null)
- rooms.Add(room);
- else
- existing.CopyFrom(room);
- }
-
private void notifyRoomsUpdated() => Scheduler.AddOnce(() => RoomsUpdated?.Invoke());
}
}