Speed up Map.ContainsAllProjectedCellsCovering on flat maps.

This method gets called often via Contains calls. We can significantly speed up the method for flat maps since we know the projection and it is trivial to perform. This avoids an expensive projection lookup.
This commit is contained in:
RoosterDragon
2015-08-20 21:12:21 +01:00
parent 76303e9699
commit d9dd96ca35

View File

@@ -767,6 +767,9 @@ namespace OpenRA
bool ContainsAllProjectedCellsCovering(MPos uv) bool ContainsAllProjectedCellsCovering(MPos uv)
{ {
if (MaximumTerrainHeight == 0)
return Contains((PPos)uv);
foreach (var puv in ProjectedCellsCovering(uv)) foreach (var puv in ProjectedCellsCovering(uv))
if (!Contains(puv)) if (!Contains(puv))
return false; return false;