diff --git a/OpenRa.Game/GameRules/Footprint.cs b/OpenRa.Game/GameRules/Footprint.cs index 7562b89c1f..165ab82b5d 100644 --- a/OpenRa.Game/GameRules/Footprint.cs +++ b/OpenRa.Game/GameRules/Footprint.cs @@ -7,11 +7,6 @@ namespace OpenRa.GameRules { static class Footprint { - public static IEnumerable Tiles( string name, BuildingInfo buildingInfo, int2 position ) - { - return Tiles(name, buildingInfo, position, true); - } - public static IEnumerable Tiles( string name, BuildingInfo buildingInfo, int2 position, bool adjustForPlacement ) { var dim = buildingInfo.Dimensions; diff --git a/OpenRa.Game/UiOverlay.cs b/OpenRa.Game/UiOverlay.cs index 91e8e24074..97642bebcb 100644 --- a/OpenRa.Game/UiOverlay.cs +++ b/OpenRa.Game/UiOverlay.cs @@ -46,9 +46,10 @@ namespace OpenRa public void DrawBuildingGrid( string name, BuildingInfo bi ) { var position = Game.controller.MousePosition.ToInt2(); + var topLeft = position - Footprint.AdjustForBuildingSize( bi ); var isCloseEnough = Game.world.IsCloseEnoughToBase(Game.LocalPlayer, name, bi, position); - foreach( var t in Footprint.Tiles( name, bi, position ) ) + foreach( var t in Footprint.Tiles( name, bi, topLeft, false ) ) spriteRenderer.DrawSprite( ( isCloseEnough && Game.world.IsCellBuildable( t, bi.WaterBound ? UnitMovementType.Float : UnitMovementType.Wheel ) && !Game.world.Map.ContainsResource( t ) ) ? buildOk : buildBlocked, Game.CellSize * t, 0 ); diff --git a/OpenRa.Game/WorldUtils.cs b/OpenRa.Game/WorldUtils.cs index 3f9a84ab66..500e25f013 100755 --- a/OpenRa.Game/WorldUtils.cs +++ b/OpenRa.Game/WorldUtils.cs @@ -125,7 +125,8 @@ namespace OpenRa ignoreTerrain = true, }; - foreach (var t in Footprint.Tiles(buildingName, bi, position)) search.AddInitialCell(t); + var topLeft = position - Footprint.AdjustForBuildingSize( bi ); + foreach (var t in Footprint.Tiles(buildingName, bi, topLeft, false)) search.AddInitialCell(t); return world.PathFinder.FindPath(search).Count != 0; }