On orders, the mouse button is now considered part on issuing the order, not resolving it.

This commit is contained in:
Bob
2009-10-24 19:42:54 +13:00
parent d25bd8550a
commit 78c9ae53df
11 changed files with 85 additions and 92 deletions

View File

@@ -17,21 +17,32 @@ namespace OpenRa.Game
Name = name;
}
public IEnumerable<Order> Order(int2 xy)
public IEnumerable<Order> Order(int2 xy, bool lmb)
{
// todo: check that space is free
var bi = (UnitInfo.BuildingInfo)Rules.UnitInfo[Name];
if (Footprint.Tiles(bi, xy).Any(
t => !Game.IsCellBuildable(t,
bi.WaterBound ? UnitMovementType.Float : UnitMovementType.Wheel)))
yield break;
if( lmb )
{
// todo: check that space is free
var bi = (UnitInfo.BuildingInfo)Rules.UnitInfo[ Name ];
if( Footprint.Tiles( bi, xy ).Any(
t => !Game.IsCellBuildable( t,
bi.WaterBound ? UnitMovementType.Float : UnitMovementType.Wheel ) ) )
yield break;
var maxDistance = bi.Adjacent + 2; /* real-ra is weird. this is 1 GAP. */
if (!Footprint.Tiles(bi, xy).Any(
t => Game.GetDistanceToBase(t, Owner) < maxDistance))
yield break;
var maxDistance = bi.Adjacent + 2; /* real-ra is weird. this is 1 GAP. */
if( !Footprint.Tiles( bi, xy ).Any(
t => Game.GetDistanceToBase( t, Owner ) < maxDistance ) )
yield break;
yield return new PlaceBuildingOrder(this, xy);
yield return new PlaceBuildingOrder( this, xy );
}
else // rmb
{
Game.world.AddFrameEndTask( _ =>
{
Game.controller.orderGenerator = null;
Game.worldRenderer.uiOverlay.KillOverlay();
} );
}
}
public void PrepareOverlay(int2 xy)