Don't crash if trying to check targets outside the map.

This commit is contained in:
Paul Chote
2013-11-01 17:42:48 +13:00
parent 4754a8019a
commit f1f032dbb8

View File

@@ -172,6 +172,9 @@ namespace OpenRA.GameRules
if (target.Type == TargetType.Terrain) if (target.Type == TargetType.Terrain)
{ {
var cell = target.CenterPosition.ToCPos(); var cell = target.CenterPosition.ToCPos();
if (!world.Map.IsInMap(cell))
return false;
if (ValidTargets.Contains("Ground") && world.GetTerrainType(cell) != "Water") if (ValidTargets.Contains("Ground") && world.GetTerrainType(cell) != "Water")
return true; return true;