1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:12:54 +08:00

Update pointless CompareTo implementation once again

This commit is contained in:
Salman Ahmed 2022-02-11 04:01:10 +03:00
parent 9574bc1382
commit 1b729e891d

View File

@ -11,7 +11,7 @@ namespace osu.Game.Rulesets
{
[ExcludeFromDynamicCompile]
[Table(@"RulesetInfo")]
public sealed class EFRulesetInfo : IEquatable<EFRulesetInfo>, IRulesetInfo
public sealed class EFRulesetInfo : IEquatable<EFRulesetInfo>, IComparable<EFRulesetInfo>, IRulesetInfo
{
public int? ID { get; set; }
@ -42,7 +42,15 @@ namespace osu.Game.Rulesets
public bool Equals(EFRulesetInfo other) => other != null && ID == other.ID && Available == other.Available && Name == other.Name && InstantiationInfo == other.InstantiationInfo;
public int CompareTo(RulesetInfo other) => OnlineID.CompareTo(other.OnlineID);
public int CompareTo(EFRulesetInfo other) => OnlineID.CompareTo(other.OnlineID);
public int CompareTo(IRulesetInfo other)
{
if (!(other is EFRulesetInfo ruleset))
throw new ArgumentException($@"Object is not of type {nameof(EFRulesetInfo)}.", nameof(other));
return CompareTo(ruleset);
}
public override bool Equals(object obj) => obj is EFRulesetInfo rulesetInfo && Equals(rulesetInfo);