mirror of https://github.com/ppy/osu
Update pointless `CompareTo` implementation once again
This commit is contained in:
parent
9574bc1382
commit
1b729e891d
|
@ -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 @@ public Ruleset CreateInstance()
|
|||
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue