removed "adjust" param to Tiles; position is now top-left always.

This commit is contained in:
Bob
2010-01-18 14:17:46 +13:00
parent aac9a01c49
commit 7913fcf75b
4 changed files with 8 additions and 10 deletions

View File

@@ -101,7 +101,8 @@ namespace OpenRa
public static bool CanPlaceBuilding(this World world, string name, BuildingInfo building, int2 xy, Actor toIgnore, bool adjust)
{
return !Footprint.Tiles(name, building, xy, adjust).Any(
var topLeft = adjust ? xy - Footprint.AdjustForBuildingSize( building ) : xy;
return !Footprint.Tiles(name, building, topLeft).Any(
t => !world.Map.IsInMap(t.X, t.Y) || world.Map.ContainsResource(t) || !world.IsCellBuildable(t,
building.WaterBound ? UnitMovementType.Float : UnitMovementType.Wheel,
toIgnore));
@@ -126,7 +127,7 @@ namespace OpenRa
};
var topLeft = position - Footprint.AdjustForBuildingSize( bi );
foreach (var t in Footprint.Tiles(buildingName, bi, topLeft, false)) search.AddInitialCell(t);
foreach (var t in Footprint.Tiles(buildingName, bi, topLeft)) search.AddInitialCell(t);
return world.PathFinder.FindPath(search).Count != 0;
}