Skip to content

Commit

Permalink
fixed PlaceBuilding and Chronosphere ordergenerators
Browse files Browse the repository at this point in the history
  • Loading branch information
ytinasni authored and pchote committed Oct 7, 2010
1 parent aebef4f commit 3209da4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
8 changes: 7 additions & 1 deletion OpenRA.Mods.RA/Orders/PlaceBuildingOrderGenerator.cs
Expand Up @@ -32,7 +32,13 @@ public IEnumerable<Order> Order(World world, int2 xy, MouseInput mi)
if (mi.Button == MouseButton.Right)
world.CancelInputMode();

return InnerOrder(world, xy, mi);
var ret = InnerOrder( world, xy, mi ).ToList();
foreach( var order in ret )
{
world.CancelInputMode();
break;
}
return ret;
}

IEnumerable<Order> InnerOrder(World world, int2 xy, MouseInput mi)
Expand Down
20 changes: 17 additions & 3 deletions OpenRA.Mods.RA/SupportPowers/ChronoshiftPower.cs
Expand Up @@ -32,7 +32,7 @@ public void ResolveOrder(Actor self, Order order)

if (order.OrderString == "ChronosphereSelect" && self.Owner == self.World.LocalPlayer)
{
self.World.OrderGenerator = new SelectDestination(order.TargetActor);
//self.World.OrderGenerator = new SelectDestination(order.TargetActor);
}

if (order.OrderString == "ChronosphereActivate")
Expand Down Expand Up @@ -60,7 +60,13 @@ public IEnumerable<Order> Order(World world, int2 xy, MouseInput mi)
if (mi.Button == MouseButton.Right)
world.CancelInputMode();

return OrderInner(world, xy, mi);
var ret = OrderInner( world, xy, mi ).ToList();
foreach( var order in ret )
{
world.OrderGenerator = new SelectDestination(order.TargetActor);
break;
}
return ret;
}

IEnumerable<Order> OrderInner(World world, int2 xy, MouseInput mi)
Expand Down Expand Up @@ -109,11 +115,19 @@ class SelectDestination : IOrderGenerator
public IEnumerable<Order> Order(World world, int2 xy, MouseInput mi)
{
if (mi.Button == MouseButton.Right)
world.CancelInputMode();

var ret = OrderInner( world, xy, mi ).ToList();
foreach( var order in ret )
{
world.CancelInputMode();
yield break;
break;
}
return ret;
}

IEnumerable<Order> OrderInner(World world, int2 xy, MouseInput mi)
{
// Cannot chronoshift into unexplored location
if (world.LocalPlayer.Shroud.IsExplored(xy))
yield return new Order("ChronosphereActivate", world.LocalPlayer.PlayerActor, self, xy);
Expand Down
7 changes: 5 additions & 2 deletions OpenRA.Mods.RA/SupportPowers/IronCurtainPower.cs
Expand Up @@ -75,8 +75,11 @@ IEnumerable<Order> OrderInner(World world, int2 xy, MouseInput mi)
&& a.HasTrait<IronCurtainable>()
&& a.HasTrait<Selectable>()).FirstOrDefault();

if (underCursor != null)
yield return new Order("IronCurtain", underCursor.Owner.PlayerActor, underCursor);
if( underCursor != null )
{
world.CancelInputMode();
yield return new Order( "IronCurtain", underCursor.Owner.PlayerActor, underCursor );
}
}

yield break;
Expand Down

0 comments on commit 3209da4

Please sign in to comment.