From 21b7d0eadb9b94a0675a86f3ab60a7c554ceb44d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 2 Nov 2013 23:12:39 +0100 Subject: [PATCH] loop all orders only once --- .../WorldInteractionControllerWidget.cs | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs index 0b039a487c..806bc79d1e 100644 --- a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs @@ -138,22 +138,27 @@ namespace OpenRA.Widgets var pos = worldRenderer.Position(xy); var orders = world.OrderGenerator.Order(world, pos.ToCPos(), mi).ToArray(); - orders.Do(o => world.IssueOrder(o)); world.PlayVoiceForOrders(orders); + var flashed = false; foreach (var o in orders) { - if (o.TargetActor != null) + if (!flashed) { - world.Add(new FlashTarget(o.TargetActor)); - break; - } - else if (o.Subject != world.LocalPlayer.PlayerActor && o.TargetLocation != CPos.Zero) - { - world.Add(new MoveFlash(worldRenderer.Position(worldRenderer.Viewport.ViewToWorldPx(mi.Location)), world)); - break; + if (o.TargetActor != null) + { + world.AddFrameEndTask(w => w.Add(new FlashTarget(o.TargetActor))); + flashed = true; + } + else if (o.Subject != world.LocalPlayer.PlayerActor && o.TargetLocation != CPos.Zero) // TODO: this filters building placement, but also suppport powers :( + { + world.AddFrameEndTask(w => w.Add(new MoveFlash(worldRenderer.Position(worldRenderer.Viewport.ViewToWorldPx(mi.Location)), world))); + flashed = true; + } } + + world.IssueOrder(o); } }