diff --git a/OpenRA.Game/Network/UnitOrders.cs b/OpenRA.Game/Network/UnitOrders.cs index ed65a20529..3030099777 100755 --- a/OpenRA.Game/Network/UnitOrders.cs +++ b/OpenRA.Game/Network/UnitOrders.cs @@ -109,6 +109,7 @@ namespace OpenRA.Network } orderManager.world.Paused = pause; + orderManager.world.PredictedPaused = pause; } break; } diff --git a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs index 4debabcfa1..cbe1d9ed03 100644 --- a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs @@ -175,7 +175,7 @@ namespace OpenRA.Widgets return true; } else if (e.KeyName == Game.Settings.Keys.PauseKey) - world.IssueOrder(Order.PauseGame(!world.Paused)); + world.SetPauseState(!world.Paused); } return false; } diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index 0845bba5ff..7c2d6177a6 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -177,9 +177,16 @@ namespace OpenRA public event Action ActorAdded = _ => { }; public event Action ActorRemoved = _ => { }; - public bool Paused = false; + public bool Paused { get; internal set; } + public bool PredictedPaused { get; internal set; } public bool IsShellmap = false; + public void SetPauseState(bool paused) + { + IssueOrder(Order.PauseGame(paused)); + PredictedPaused = paused; + } + public void Tick() { if (!Paused && (!IsShellmap || Game.Settings.Game.ShowShellmap)) diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameChromeLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameChromeLogic.cs index 915afa106b..9a941734d3 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameChromeLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameChromeLogic.cs @@ -55,11 +55,11 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic public void OptionsClicked() { - var cachedPause = world.Paused; + var cachedPause = world.PredictedPaused; ingameRoot.IsVisible = () => false; if (world.LobbyInfo.IsSinglePlayer) - world.IssueOrder(Order.PauseGame(true)); + world.SetPauseState(true); Game.LoadWidget(world, "INGAME_MENU", Ui.Root, new WidgetArgs() { @@ -67,7 +67,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic { ingameRoot.IsVisible = () => true; if (world.LobbyInfo.IsSinglePlayer) - world.IssueOrder(Order.PauseGame(cachedPause)); + world.SetPauseState(cachedPause); } } }); diff --git a/OpenRA.Mods.RA/Scripting/Media.cs b/OpenRA.Mods.RA/Scripting/Media.cs index 6bfdb5e4f6..310ee4239c 100644 --- a/OpenRA.Mods.RA/Scripting/Media.cs +++ b/OpenRA.Mods.RA/Scripting/Media.cs @@ -32,7 +32,7 @@ namespace OpenRA.Scripting return; } - w.Paused = true; + w.SetPauseState(true); // Mute world sounds var oldModifier = Sound.SoundVolumeModifier; @@ -51,7 +51,7 @@ namespace OpenRA.Scripting Ui.CloseWindow(); Sound.SoundVolumeModifier = oldModifier; - w.Paused = false; + w.SetPauseState(false); onComplete(); }); } diff --git a/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs index 93b6f4f9c1..6a532d3a2c 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs @@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic optionsBG.Visible = false; if (world.LobbyInfo.IsSinglePlayer) - world.IssueOrder(Order.PauseGame(cachedPause)); + world.SetPauseState(cachedPause); } } }); @@ -57,13 +57,13 @@ namespace OpenRA.Mods.RA.Widgets.Logic optionsBG.Visible ^= true; if (optionsBG.Visible) { - cachedPause = world.Paused; + cachedPause = world.PredictedPaused; if (world.LobbyInfo.IsSinglePlayer) - world.IssueOrder(Order.PauseGame(true)); + world.SetPauseState(true); } else - world.IssueOrder(Order.PauseGame(cachedPause)); + world.SetPauseState(cachedPause); }; Game.LoadWidget(world, "CHAT_PANEL", gameRoot, new WidgetArgs());