From a3b6a3981c04c522d18b915b976916f066460149 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 27 Dec 2018 16:14:30 +0900 Subject: [PATCH] Use .Equals() override instead of manual type checks --- osu.Game/Online/Multiplayer/Room.cs | 9 ++------- osu.Game/Online/Multiplayer/RoomStatus.cs | 3 +++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/osu.Game/Online/Multiplayer/Room.cs b/osu.Game/Online/Multiplayer/Room.cs index 80558b14db..5cf73b5617 100644 --- a/osu.Game/Online/Multiplayer/Room.cs +++ b/osu.Game/Online/Multiplayer/Room.cs @@ -88,14 +88,9 @@ namespace osu.Game.Online.Multiplayer if (other.Host.Value != null && Host.Value?.Id != other.Host.Value.Id) Host.Value = other.Host; - if (Status.Value.GetType() != other.Status.Value.GetType()) - Status.Value = other.Status; - + Status.Value = other.Status; Availability.Value = other.Availability; - - if (Type.Value.GetType() != other.Type.Value.GetType()) - Type.Value = other.Type; - + Type.Value = other.Type; MaxParticipants.Value = other.MaxParticipants; ParticipantCount.Value = other.ParticipantCount.Value; Participants.Value = other.Participants.Value.ToArray(); diff --git a/osu.Game/Online/Multiplayer/RoomStatus.cs b/osu.Game/Online/Multiplayer/RoomStatus.cs index e2d84500a9..f5c339c71f 100644 --- a/osu.Game/Online/Multiplayer/RoomStatus.cs +++ b/osu.Game/Online/Multiplayer/RoomStatus.cs @@ -10,5 +10,8 @@ namespace osu.Game.Online.Multiplayer { public abstract string Message { get; } public abstract Color4 GetAppropriateColour(OsuColour colours); + + public override int GetHashCode() => GetType().GetHashCode(); + public override bool Equals(object obj) => GetType() == obj?.GetType(); } }