From 2842f8345406bc56302538feafc8df24a15fb842 Mon Sep 17 00:00:00 2001 From: wrexbe <81056464+wrexbe@users.noreply.github.com> Date: Mon, 24 Jan 2022 03:37:49 -0800 Subject: [PATCH] HeightComparer is a little faster (#6021) --- Content.Server/Power/Pow3r/BatteryRampPegSolver.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Content.Server/Power/Pow3r/BatteryRampPegSolver.cs b/Content.Server/Power/Pow3r/BatteryRampPegSolver.cs index f21a37d824..17d1265260 100644 --- a/Content.Server/Power/Pow3r/BatteryRampPegSolver.cs +++ b/Content.Server/Power/Pow3r/BatteryRampPegSolver.cs @@ -7,16 +7,15 @@ namespace Content.Server.Power.Pow3r { public sealed class BatteryRampPegSolver : IPowerSolver { - private sealed class HeightComparer : IComparer + private sealed class HeightComparer : Comparer { 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 (ReferenceEquals(null, y)) return 1; - if (ReferenceEquals(null, x)) return -1; - return x.Height.CompareTo(y.Height); + if (x!.Height == y!.Height) return 0; + if (x!.Height > y!.Height) return 1; + return -1; } }