Changed IsCloseEnoughToBase to take top-left position.

This commit is contained in:
Bob
2010-01-18 14:22:38 +13:00
parent 7913fcf75b
commit 738d293b48
4 changed files with 7 additions and 6 deletions

View File

@@ -108,9 +108,10 @@ namespace OpenRa
toIgnore));
}
public static bool IsCloseEnoughToBase(this World world, Player p, string buildingName, BuildingInfo bi, int2 position)
public static bool IsCloseEnoughToBase(this World world, Player p, string buildingName, BuildingInfo bi, int2 topLeft)
{
var maxDistance = bi.Adjacent + 1;
var position = topLeft + Footprint.AdjustForBuildingSize( bi );
var search = new PathSearch()
{
@@ -126,7 +127,6 @@ namespace OpenRa
ignoreTerrain = true,
};
var topLeft = position - Footprint.AdjustForBuildingSize( bi );
foreach (var t in Footprint.Tiles(buildingName, bi, topLeft)) search.AddInitialCell(t);
return world.PathFinder.FindPath(search).Count != 0;