mirror of
https://github.com/ppy/osu
synced 2025-02-02 11:21:59 +00:00
Fix IMod now using reference equality as well
This commit is contained in:
parent
43f8f3638a
commit
5efcdbd431
@ -52,7 +52,8 @@ namespace osu.Game.Online.API
|
||||
return resultMod;
|
||||
}
|
||||
|
||||
public bool Equals(APIMod other) => Acronym == other?.Acronym;
|
||||
public bool Equals(IMod other) => other is APIMod them && Equals(them);
|
||||
public bool Equals(APIMod other) => ((IMod)this).Equals(other);
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
@ -1,11 +1,12 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public interface IMod
|
||||
public interface IMod : IEquatable<IMod>
|
||||
{
|
||||
/// <summary>
|
||||
/// The shortened name of this mod.
|
||||
|
@ -149,6 +149,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
return copy;
|
||||
}
|
||||
|
||||
public bool Equals(Mod other) => GetType() == other?.GetType();
|
||||
public bool Equals(IMod other) => other is Mod them && Equals(them);
|
||||
public bool Equals(Mod other) => Acronym == other?.Acronym;
|
||||
}
|
||||
}
|
||||
|
@ -256,7 +256,8 @@ namespace osu.Game.Scoring
|
||||
{
|
||||
public string Acronym { get; set; }
|
||||
|
||||
public bool Equals(DeserializedMod other) => Acronym == other?.Acronym;
|
||||
bool IEquatable<IMod>.Equals(IMod other) => other is DeserializedMod them && Equals(them);
|
||||
public bool Equals(DeserializedMod other) => ((IMod)this).Equals(other);
|
||||
}
|
||||
|
||||
public override string ToString() => $"{User} playing {Beatmap}";
|
||||
|
Loading…
Reference in New Issue
Block a user