diff --git a/OpenRa.Game/Controller.cs b/OpenRa.Game/Controller.cs index 02c76f156e..8c0bf91040 100644 --- a/OpenRa.Game/Controller.cs +++ b/OpenRa.Game/Controller.cs @@ -57,12 +57,10 @@ namespace OpenRa.Game * needs to also happen when the *thing* changes, so per-frame hook */ } - if (mi.Button == MouseButtons.Right && mi.Event == MouseInputEvent.Down) - if (orderGenerator != null) - { - var order = orderGenerator.Order(game, new int2((int)xy.X, (int)xy.Y)); - if (order != null) order.Apply(game); - } + if( mi.Button == MouseButtons.Right && mi.Event == MouseInputEvent.Down ) + if( orderGenerator != null ) + foreach( var order in orderGenerator.Order( game, new int2( (int)xy.X, (int)xy.Y ) ) ) + order.Apply( game ); } public Unit FindUnit(float2 a, float2 b) diff --git a/OpenRa.Game/IOrderGenerator.cs b/OpenRa.Game/IOrderGenerator.cs index cf605dc73a..6250a97494 100644 --- a/OpenRa.Game/IOrderGenerator.cs +++ b/OpenRa.Game/IOrderGenerator.cs @@ -6,7 +6,7 @@ namespace OpenRa.Game { interface IOrderGenerator { - Order Order( Game game, int2 xy ); + IEnumerable Order( Game game, int2 xy ); void PrepareOverlay( Game game, int2 xy ); } } diff --git a/OpenRa.Game/Sidebar.cs b/OpenRa.Game/Sidebar.cs index 9c88723637..cf505ce680 100644 --- a/OpenRa.Game/Sidebar.cs +++ b/OpenRa.Game/Sidebar.cs @@ -184,10 +184,10 @@ namespace OpenRa.Game Name = name; } - public Order Order( Game game, int2 xy ) + public IEnumerable Order( Game game, int2 xy ) { // todo: check that space is free - return new PlaceBuildingOrder( this, xy ); + yield return new PlaceBuildingOrder( this, xy ); } public void PrepareOverlay(Game game, int2 xy) diff --git a/OpenRa.Game/Unit.cs b/OpenRa.Game/Unit.cs index 276a2bf27c..543aa0d983 100644 --- a/OpenRa.Game/Unit.cs +++ b/OpenRa.Game/Unit.cs @@ -97,17 +97,17 @@ namespace OpenRa.Game return false; } - public Order Order( Game game, int2 xy ) + public IEnumerable Order( Game game, int2 xy ) { if( ( fromCell == toCell || moveFraction == 0 ) && fromCell == xy ) { if( SupportsMission( SupportedMissions.Deploy ) ) - return new DeployMcvOrder( this ); + yield return new DeployMcvOrder( this ); if( SupportsMission( SupportedMissions.Harvest ) ) - return new HarvestOrder( this ); + yield return new HarvestOrder( this ); } - - return new MoveOrder( this, xy ); + else + yield return new MoveOrder( this, xy ); } public void PrepareOverlay(Game game, int2 xy) { }