simplify Mobile using new ordering from FindTilesInCircle

This commit is contained in:
Chris Forbes
2012-10-13 12:35:30 +13:00
parent bbab5237d1
commit 3fad0983b9

View File

@@ -232,17 +232,10 @@ namespace OpenRA.Mods.RA.Move
if (CanEnterCell(target)) if (CanEnterCell(target))
return target; return target;
var searched = new List<CPos>(); foreach (var tile in self.World.FindTilesInCircle(target, maxRange))
// Limit search to a radius of 10 tiles
for (int r = minRange; r < maxRange; r++)
foreach (var tile in self.World.FindTilesInCircle(target, r).Except(searched))
{
if (CanEnterCell(tile)) if (CanEnterCell(tile))
return tile; return tile;
searched.Add(tile);
}
// Couldn't find a cell // Couldn't find a cell
return target; return target;
} }
@@ -252,16 +245,10 @@ namespace OpenRA.Mods.RA.Move
if (check(target)) if (check(target))
return target; return target;
var searched = new List<CPos>(); foreach (var tile in self.World.FindTilesInCircle(target, maxRange))
for (int r = minRange; r < maxRange; r++)
foreach (var tile in self.World.FindTilesInCircle(target, r).Except(searched))
{
if (check(tile)) if (check(tile))
return tile; return tile;
searched.Add(tile);
}
// Couldn't find a cell // Couldn't find a cell
return target; return target;
} }