Fix ActionQueue ordering.

This enforces a well defined ordering for ActionQueue to ensure it runs actions in the the order one would expect.
This commit is contained in:
RoosterDragon
2015-09-06 17:25:28 +01:00
parent bbdd597917
commit 7decfc83ea
4 changed files with 90 additions and 22 deletions

View File

@@ -384,9 +384,9 @@ namespace OpenRA
// Note: These delayed actions should only be used by widgets or disposing objects
// - things that depend on a particular world should be queuing them on the worldactor.
static ActionQueue delayedActions = new ActionQueue();
public static void RunAfterTick(Action a) { delayedActions.Add(a); }
public static void RunAfterDelay(int delay, Action a) { delayedActions.Add(a, delay); }
static volatile ActionQueue delayedActions = new ActionQueue();
public static void RunAfterTick(Action a) { delayedActions.Add(a, Game.RunTime); }
public static void RunAfterDelay(int delayMilliseconds, Action a) { delayedActions.Add(a, Game.RunTime + delayMilliseconds); }
static void TakeScreenshotInner()
{
@@ -487,7 +487,7 @@ namespace OpenRA
static void LogicTick()
{
delayedActions.PerformActions();
delayedActions.PerformActions(Game.RunTime);
if (OrderManager.Connection.ConnectionState != lastConnectionState)
{