From 173aae1f8139de0c8a9f95af40f978bc1df9961e Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Fri, 22 May 2020 13:39:42 +0200 Subject: [PATCH] Directly check the map bounds instead of converting to PPos --- OpenRA.Game/Map/Map.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/Map/Map.cs b/OpenRA.Game/Map/Map.cs index 9a52f8283f..cf101e3856 100644 --- a/OpenRA.Game/Map/Map.cs +++ b/OpenRA.Game/Map/Map.cs @@ -810,8 +810,9 @@ namespace OpenRA bool ContainsAllProjectedCellsCovering(MPos uv) { + // PERF: Checking the bounds directly here is the same as calling Contains((PPos)uv) but saves an allocation if (Grid.MaximumTerrainHeight == 0) - return Contains((PPos)uv); + return Bounds.Contains(uv.U, uv.V); // If the cell has no valid projection, then we're off the map. var projectedCells = ProjectedCellsCovering(uv);