summaryrefslogtreecommitdiff
path: root/src/console_cmds.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-05-06 15:06:57 +0000
committerrubidium <rubidium@openttd.org>2009-05-06 15:06:57 +0000
commit2664f2a2d95dbc2122ff1f9b96e8569ae401892f (patch)
treefb2112ce7a51edd259190186790bf00319a53510 /src/console_cmds.cpp
parentbb121a1510fbd3faea71b794b1f6bdaba1641665 (diff)
downloadopenttd-2664f2a2d95dbc2122ff1f9b96e8569ae401892f.tar.xz
(svn r16242) -Codechange: rework pausing
-Fix [FS#2864]: autopause and manual pausing conflict with eachother -Fix: new game + pause on new game + autopause make the game not unpause on the first join
Diffstat (limited to 'src/console_cmds.cpp')
-rw-r--r--src/console_cmds.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index ced66db8b..42e707846 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -472,8 +472,15 @@ DEF_CONSOLE_CMD(ConPauseGame)
return true;
}
- if (_pause_game == 0) {
- DoCommandP(0, 1, 0, CMD_PAUSE);
+#ifdef ENABLE_NETWORK
+ if (_network_dedicated && _settings_client.network.min_active_clients != 0) {
+ IConsolePrint(CC_WARNING, "Manual pausing is disabled. Set network.min_active_clients to 0 (disable autopausing) to enable manual pausing.");
+ return true;
+ }
+#endif /* ENABLE_NETWORK */
+
+ if (_pause_mode == PM_UNPAUSED) {
+ DoCommandP(0, PM_PAUSED_NORMAL, 1, CMD_PAUSE);
IConsolePrint(CC_DEFAULT, "Game paused.");
} else {
IConsolePrint(CC_DEFAULT, "Game is already paused.");
@@ -489,8 +496,15 @@ DEF_CONSOLE_CMD(ConUnPauseGame)
return true;
}
- if (_pause_game != 0) {
- DoCommandP(0, 0, 0, CMD_PAUSE);
+#ifdef ENABLE_NETWORK
+ if (_network_dedicated && _settings_client.network.min_active_clients != 0) {
+ IConsolePrint(CC_WARNING, "Manual unpausing is disabled. Set network.min_active_clients to 0 (disable autopausing) to enable manual unpausing.");
+ return true;
+ }
+#endif /* ENABLE_NETWORK */
+
+ if (_pause_mode != PM_UNPAUSED) {
+ DoCommandP(0, PM_PAUSED_NORMAL, 0, CMD_PAUSE);
IConsolePrint(CC_DEFAULT, "Game unpaused.");
} else {
IConsolePrint(CC_DEFAULT, "Game is already unpaused.");