Fixed the building placement to have the cursor in the centre. Replaced magic numbers with Game.CellSize

Using the building footprint, the placement overlay is offset from the cursor so the cursor is in the approximate middle of the overlay (not precisely due to overlay snapping to tiles). The tile size (24) was used as a magic number in a lot of places, they have been replaced with Game.CellSize.
This commit is contained in:
Matthew Bowra-Dean
2009-10-15 03:16:44 +13:00
parent 00cf322feb
commit fe78e22747
14 changed files with 37 additions and 22 deletions

View File

@@ -42,9 +42,9 @@ namespace OpenRa.Game
if (!(orderGenerator is PlaceBuilding))
{
if (dragStart != xy)
orderGenerator = new UnitOrderGenerator( game.FindUnits( 24 * dragStart, 24 * xy ) ); /* band-box select */
orderGenerator = new UnitOrderGenerator( game.FindUnits( Game.CellSize * dragStart, Game.CellSize * xy ) ); /* band-box select */
else
orderGenerator = new UnitOrderGenerator( game.FindUnits( 24 * xy, 24 * xy ) ); /* click select */
orderGenerator = new UnitOrderGenerator( game.FindUnits( Game.CellSize * xy, Game.CellSize * xy ) ); /* click select */
}
dragStart = dragEnd;
@@ -67,7 +67,7 @@ namespace OpenRa.Game
get
{
if (dragStart == dragEnd) return null;
return Pair.New(24 * dragStart, 24 * dragEnd);
return Pair.New(Game.CellSize * dragStart, Game.CellSize * dragEnd);
}
}
}