diff --git a/OpenRA.Game/Graphics/Viewport.cs b/OpenRA.Game/Graphics/Viewport.cs index c886f4cbab..32fdcf9048 100644 --- a/OpenRA.Game/Graphics/Viewport.cs +++ b/OpenRA.Game/Graphics/Viewport.cs @@ -282,7 +282,7 @@ namespace OpenRA.Graphics // Try and find the closest cell if (candidates.Count > 0) { - return candidates.OrderBy(uv => + return candidates.MinBy(uv => { var p = map.CenterOfCell(uv.ToCPos(map.Grid.Type)); var s = worldRenderer.ScreenPxPosition(p); @@ -290,7 +290,7 @@ namespace OpenRA.Graphics var dy = Math.Abs(s.Y - world.Y); return dx * dx + dy * dy; - }).First().ToCPos(map); + }).ToCPos(map); } // Something is very wrong, but lets return something that isn't completely bogus and hope the caller can recover diff --git a/OpenRA.Game/Network/FrameData.cs b/OpenRA.Game/Network/FrameData.cs index 2acda3ec85..991eb50072 100644 --- a/OpenRA.Game/Network/FrameData.cs +++ b/OpenRA.Game/Network/FrameData.cs @@ -43,7 +43,7 @@ namespace OpenRA.Network if (lastClientFrame == -1) lastClientFrame = framePackets .Where(x => x.Value.ContainsKey(clientId)) - .Select(x => x.Key).OrderBy(x => x).LastOrDefault(); + .Select(x => x.Key).MaxByOrDefault(x => x); clientQuitTimes[clientId] = lastClientFrame; } diff --git a/OpenRA.Mods.Common/Traits/Render/ProductionBar.cs b/OpenRA.Mods.Common/Traits/Render/ProductionBar.cs index 73a9e5f0f1..b91fcf795f 100644 --- a/OpenRA.Mods.Common/Traits/Render/ProductionBar.cs +++ b/OpenRA.Mods.Common/Traits/Render/ProductionBar.cs @@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits.Render if (IsTraitDisabled) return; - var current = queue.AllQueued().Where(i => i.Started).OrderBy(i => i.RemainingTime).FirstOrDefault(); + var current = queue.AllQueued().Where(i => i.Started).MinByOrDefault(i => i.RemainingTime); value = current != null ? 1 - (float)current.RemainingCost / current.TotalCost : 0; }