Skip to content

Commit 173aae1

Browse files
abcdefg30teinarss
authored andcommitted
Directly check the map bounds instead of converting to PPos
1 parent baed809 commit 173aae1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

OpenRA.Game/Map/Map.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,8 +810,9 @@ public bool Contains(MPos uv)
810810

811811
bool ContainsAllProjectedCellsCovering(MPos uv)
812812
{
813+
// PERF: Checking the bounds directly here is the same as calling Contains((PPos)uv) but saves an allocation
813814
if (Grid.MaximumTerrainHeight == 0)
814-
return Contains((PPos)uv);
815+
return Bounds.Contains(uv.U, uv.V);
815816

816817
// If the cell has no valid projection, then we're off the map.
817818
var projectedCells = ProjectedCellsCovering(uv);

0 commit comments

Comments
 (0)