Removes old comparable/comparers. (#31)

This commit is contained in:
Kamron Batman 2019-03-11 15:35:04 -07:00 • committed by GitHub
parent 513e54f70e
commit a45094f2dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 95 additions and 249 deletions

View file

@ -1116,7 +1116,7 @@ namespace Server.Engines.ConPVP
}
}
public sealed class BRPlayerInfo : IRankedCTF, IComparable
public sealed class BRPlayerInfo : IRankedCTF, IComparable<BRPlayerInfo>
{
private int m_Captures;
@ -1133,17 +1133,16 @@ namespace Server.Engines.ConPVP
public Mobile Player{ get; }
public int CompareTo(object obj)
public int CompareTo(BRPlayerInfo pi)
{
BRPlayerInfo pi = (BRPlayerInfo)obj;
int res = pi.Captures.CompareTo(Captures);
if (res == 0)
{
res = pi.Score.CompareTo(Score);
if (res != 0)
return res;
if (res == 0)
res = pi.Kills.CompareTo(Kills);
}
res = pi.Score.CompareTo(Score);
if (res == 0)
res = pi.Kills.CompareTo(Kills);
return res;
}

View file

@ -555,7 +555,7 @@ namespace Server.Engines.ConPVP
}
[PropertyObject]
public sealed class KHTeamInfo : IRankedCTF, IComparable
public sealed class KHTeamInfo : IRankedCTF, IComparable<KHTeamInfo>
{
public KHTeamInfo(int teamID)
{
@ -609,30 +609,21 @@ namespace Server.Engines.ConPVP
[CommandProperty(AccessLevel.GameMaster)]
public string TeamName{ get; set; }
public int CompareTo(object obj)
public int CompareTo(KHTeamInfo ti)
{
KHTeamInfo ti = (KHTeamInfo)obj;
int res = ti.Score.CompareTo(Score);
if (res == 0)
{
res = ti.Captures.CompareTo(Captures);
if (res != 0)
return res;
if (res == 0)
res = ti.Kills.CompareTo(Kills);
}
res = ti.Captures.CompareTo(Captures);
if (res == 0)
res = ti.Kills.CompareTo(Kills);
return res;
}
public string Name
{
get
{
if (TeamName == null)
return "(null) Team";
return $"{TeamName} Team";
}
}
public string Name => $"{TeamName ?? "(none)"} Team";
public int Kills{ get; set; }
@ -661,9 +652,7 @@ namespace Server.Engines.ConPVP
public override string ToString()
{
if (TeamName != null)
return $"({Name}) ...";
return "...";
return TeamName != null ? $"({Name}) ..." : "...";
}
}