HeightComparer is a little faster (#6021)

This commit is contained in:
wrexbe
2022-01-24 03:37:49 -08:00
committed by GitHub
parent fffe0d14eb
commit 2842f83454

View File

@@ -7,16 +7,15 @@ namespace Content.Server.Power.Pow3r
{ {
public sealed class BatteryRampPegSolver : IPowerSolver public sealed class BatteryRampPegSolver : IPowerSolver
{ {
private sealed class HeightComparer : IComparer<Network> private sealed class HeightComparer : Comparer<Network>
{ {
public static HeightComparer Instance { get; } = new(); public static HeightComparer Instance { get; } = new();
public int Compare(Network? x, Network? y) public override int Compare(Network? x, Network? y)
{ {
if (ReferenceEquals(x, y)) return 0; if (x!.Height == y!.Height) return 0;
if (ReferenceEquals(null, y)) return 1; if (x!.Height > y!.Height) return 1;
if (ReferenceEquals(null, x)) return -1; return -1;
return x.Height.CompareTo(y.Height);
} }
} }