Revert "new PauseState to differentiate game and editor pausing"

This reverts commit d1e18cad7a.
This commit is contained in:
Paul Chote
2014-07-08 10:40:23 +12:00
parent 18c9a25232
commit 802b6a652c
10 changed files with 21 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS) * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
@@ -102,15 +102,15 @@ namespace OpenRA.Network
var client = orderManager.LobbyInfo.ClientWithIndex(clientId); var client = orderManager.LobbyInfo.ClientWithIndex(clientId);
if (client != null) if (client != null)
{ {
var pauseState = order.TargetString == "Pause" ? World.PauseState.Paused : World.PauseState.Active; var pause = order.TargetString == "Pause";
if (orderManager.world.Paused != pauseState && !world.LobbyInfo.IsSinglePlayer) if (orderManager.world.Paused != pause && !world.LobbyInfo.IsSinglePlayer)
{ {
var pausetext = "The game is {0} by {1}.".F(pauseState == World.PauseState.Paused ? "paused" : "un-paused", client.Name); var pausetext = "The game is {0} by {1}".F(pause ? "paused" : "un-paused", client.Name);
Game.AddChatLine(Color.White, "", pausetext); Game.AddChatLine(Color.White, "", pausetext);
} }
orderManager.world.Paused = pauseState; orderManager.world.Paused = pause;
orderManager.world.PredictedPaused = pauseState; orderManager.world.PredictedPaused = pause;
} }
break; break;
} }

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Traits
public class DebugPauseState : ISync public class DebugPauseState : ISync
{ {
World world; World world;
[Sync] public bool Paused { get { return world.Paused == World.PauseState.Paused; } } [Sync] public bool Paused { get { return world.Paused; } }
public DebugPauseState(World world) { this.world = world; } public DebugPauseState(World world) { this.world = world; }
} }
} }

View File

@@ -199,7 +199,7 @@ namespace OpenRA.Widgets
var key = Hotkey.FromKeyInput(e); var key = Hotkey.FromKeyInput(e);
if (key == Game.Settings.Keys.PauseKey && World.LocalPlayer != null) // Disable pausing for spectators if (key == Game.Settings.Keys.PauseKey && World.LocalPlayer != null) // Disable pausing for spectators
World.SetPauseState(World.Paused != World.PauseState.Paused); World.SetPauseState(!World.Paused);
else if (key == Game.Settings.Keys.SelectAllUnitsKey) else if (key == Game.Settings.Keys.SelectAllUnitsKey)
{ {
var ownUnitsOnScreen = SelectActorsInBox(World, worldRenderer.Viewport.TopLeft, worldRenderer.Viewport.BottomRight, var ownUnitsOnScreen = SelectActorsInBox(World, worldRenderer.Viewport.TopLeft, worldRenderer.Viewport.BottomRight,

View File

@@ -203,9 +203,8 @@ namespace OpenRA
public event Action<Actor> ActorAdded = _ => { }; public event Action<Actor> ActorAdded = _ => { };
public event Action<Actor> ActorRemoved = _ => { }; public event Action<Actor> ActorRemoved = _ => { };
public enum PauseState { Active, Paused, Editor } public bool Paused { get; internal set; }
public PauseState Paused { get; internal set; } public bool PredictedPaused { get; internal set; }
public PauseState PredictedPaused { get; internal set; }
public bool PauseStateLocked { get; set; } public bool PauseStateLocked { get; set; }
public bool IsShellmap = false; public bool IsShellmap = false;
public int WorldTick { get; private set; } public int WorldTick { get; private set; }
@@ -216,17 +215,17 @@ namespace OpenRA
return; return;
IssueOrder(Order.PauseGame(paused)); IssueOrder(Order.PauseGame(paused));
PredictedPaused = paused ? PauseState.Paused : PauseState.Active;; PredictedPaused = paused;
} }
public void SetLocalPauseState(PauseState paused) public void SetLocalPauseState(bool paused)
{ {
Paused = PredictedPaused = paused; Paused = PredictedPaused = paused;
} }
public void Tick() public void Tick()
{ {
if (Paused != PauseState.Paused && (!IsShellmap || Game.Settings.Game.ShowShellmap)) if (!Paused && (!IsShellmap || Game.Settings.Game.ShowShellmap))
{ {
WorldTick++; WorldTick++;

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
public void OptionsClicked() public void OptionsClicked()
{ {
var cachedPause = world.PredictedPaused == World.PauseState.Paused; var cachedPause = world.PredictedPaused;
ingameRoot.IsVisible = () => false; ingameRoot.IsVisible = () => false;
if (world.LobbyInfo.IsSinglePlayer) if (world.LobbyInfo.IsSinglePlayer)

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA
{ {
case "pause": case "pause":
world.IssueOrder(new Order("PauseGame", null, false) world.IssueOrder(new Order("PauseGame", null, false)
{ TargetString = world.Paused == World.PauseState.Paused ? "UnPause" : "Pause" }); { TargetString = world.Paused ? "UnPause" : "Pause" });
break; break;
case "surrender": case "surrender":
world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false)); world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false));

View File

@@ -54,7 +54,7 @@ namespace OpenRA.Mods.RA.Orders
IEnumerable<Order> InnerOrder(World world, CPos xy, MouseInput mi) IEnumerable<Order> InnerOrder(World world, CPos xy, MouseInput mi)
{ {
if (world.Paused == World.PauseState.Paused) if (world.Paused)
yield break; yield break;
if (mi.Button == MouseButton.Left) if (mi.Button == MouseButton.Left)

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA.Render
public object Create(ActorInitializer init) { return new WithActiveAnimation(init.self, this); } public object Create(ActorInitializer init) { return new WithActiveAnimation(init.self, this); }
} }
public class WithActiveAnimation : ITickRender, INotifyBuildComplete, INotifySold public class WithActiveAnimation : ITick, INotifyBuildComplete, INotifySold
{ {
readonly IEnumerable<IDisable> disabled; readonly IEnumerable<IDisable> disabled;
readonly WithActiveAnimationInfo info; readonly WithActiveAnimationInfo info;
@@ -42,11 +42,8 @@ namespace OpenRA.Mods.RA.Render
} }
int ticks; int ticks;
public void TickRender(WorldRenderer wr, Actor self) public void Tick(Actor self)
{ {
if (wr.world.Paused == World.PauseState.Paused)
return;
if (!buildComplete) if (!buildComplete)
return; return;

View File

@@ -27,12 +27,12 @@ namespace OpenRA.Mods.RA.Widgets.Logic
{ {
var startTick = Ui.LastTickTime; var startTick = Ui.LastTickTime;
// Blink the status line // Blink the status line
status.IsVisible = () => (world.Paused == World.PauseState.Paused || world.Timestep != Game.Timestep) status.IsVisible = () => (world.Paused || world.Timestep != Game.Timestep)
&& (Ui.LastTickTime - startTick) / 1000 % 2 == 0; && (Ui.LastTickTime - startTick) / 1000 % 2 == 0;
status.GetText = () => status.GetText = () =>
{ {
if (world.Paused == World.PauseState.Paused || world.Timestep == 0) if (world.Paused || world.Timestep == 0)
return "Paused"; return "Paused";
if (world.Timestep == 1) if (world.Timestep == 1)

View File

@@ -57,7 +57,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
optionsBG.Visible ^= true; optionsBG.Visible ^= true;
if (optionsBG.Visible) if (optionsBG.Visible)
{ {
cachedPause = world.PredictedPaused == World.PauseState.Paused; cachedPause = world.PredictedPaused;
if (world.LobbyInfo.IsSinglePlayer) if (world.LobbyInfo.IsSinglePlayer)
world.SetPauseState(true); world.SetPauseState(true);