Update other usages of online ID comparisons to use new extension method

This commit is contained in:
Dean Herbert
2021-11-15 14:38:14 +09:00
parent 93fe57d399
commit 285b161da7
7 changed files with 14 additions and 19 deletions

View File

@ -4,6 +4,7 @@
using System;
using Newtonsoft.Json;
using osu.Game.Beatmaps;
using osu.Game.Extensions;
using osu.Game.Rulesets;
#nullable enable
@ -106,13 +107,7 @@ namespace osu.Game.Online.API.Requests.Responses
#region Implementation of IEquatable<IBeatmapInfo>
public bool Equals(IBeatmapInfo? other)
{
if (OnlineID > 0 && other?.OnlineID > 0)
return other.OnlineID == OnlineID;
return false;
}
public bool Equals(IBeatmapInfo? other) => this.MatchesOnlineID(other);
#endregion
}

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using Newtonsoft.Json;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Extensions;
#nullable enable
@ -144,13 +145,7 @@ namespace osu.Game.Online.API.Requests.Responses
#region Implementation of IEquatable<IBeatmapSetInfo>
public bool Equals(IBeatmapSetInfo? other)
{
if (OnlineID > 0 && other?.OnlineID > 0)
return other.OnlineID == OnlineID;
return false;
}
public bool Equals(IBeatmapInfo? other) => this.MatchesOnlineID(other);
#endregion
}

View File

@ -7,6 +7,7 @@ using System.Linq;
using JetBrains.Annotations;
using Newtonsoft.Json;
using osu.Framework.Bindables;
using osu.Game.Extensions;
using osu.Game.Users;
namespace osu.Game.Online.API.Requests.Responses
@ -240,6 +241,6 @@ namespace osu.Game.Online.API.Requests.Responses
public int OnlineID => Id;
public bool Equals(APIUser other) => OnlineID == other?.OnlineID;
public bool Equals(APIUser other) => this.MatchesOnlineID(other);
}
}