Move FindTilesInCircle from WorldUtils to Map

This commit is contained in:
Pavlos Touboulidis
2014-06-13 14:24:53 +03:00
parent 03b8096807
commit 060d5326ed
11 changed files with 70 additions and 60 deletions

View File

@@ -324,13 +324,15 @@ namespace OpenRA.Mods.RA.Move
var searched = new List<CPos>();
// 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))
{
foreach (var tile in self.World.Map.FindTilesInCircle(target, r).Except(searched))
{
if (CanEnterCell(tile))
return tile;
searched.Add(tile);
}
}
// Couldn't find a cell
return target;
@@ -343,13 +345,15 @@ namespace OpenRA.Mods.RA.Move
var searched = new List<CPos>();
for (int r = minRange; r < maxRange; r++)
foreach (var tile in self.World.FindTilesInCircle(target, r).Except(searched))
{
foreach (var tile in self.World.Map.FindTilesInCircle(target, r).Except(searched))
{
if (check(tile))
return tile;
searched.Add(tile);
}
}
// Couldn't find a cell
return target;

View File

@@ -92,7 +92,7 @@ namespace OpenRA.Mods.RA.Move
// Select only the tiles that are within range from the requested SubCell
// This assumes that the SubCell does not change during the path traversal
var tilesInRange = world.FindTilesInCircle(targetCell, range.Range / 1024 + 1)
var tilesInRange = world.Map.FindTilesInCircle(targetCell, range.Range / 1024 + 1)
.Where(t => (t.CenterPosition - target).LengthSquared <= rangeSquared
&& mi.CanEnterCell(self.World, self, t, null, true, true));