From 934e6a295d16055d1bcc6ffbbdf6f2b89d36bbe6 Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 12 Nov 2009 17:46:04 +0000 Subject: [PATCH] (svn r18051) -Codechange: make the active clients pause use a separate bit in the pause mode --- src/misc_cmd.cpp | 1 + src/network/network.cpp | 8 ++++---- src/openttd.h | 11 ++++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp index fe8acb6642..ee46928c30 100644 --- a/src/misc_cmd.cpp +++ b/src/misc_cmd.cpp @@ -350,6 +350,7 @@ CommandCost CmdPause(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, #ifdef ENABLE_NETWORK case PM_PAUSED_JOIN: + case PM_PAUSED_ACTIVE_CLIENTS: if (!_networking) return CMD_ERROR; break; #endif diff --git a/src/network/network.cpp b/src/network/network.cpp index d2af1f24ab..957e764fe4 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -377,14 +377,14 @@ static void CheckMinActiveClients() if (!_network_dedicated || _settings_client.network.min_active_clients == 0 || (_pause_mode & PM_PAUSED_ERROR) != 0) return; if (NetworkCountActiveClients() < _settings_client.network.min_active_clients) { - if ((_pause_mode & PM_PAUSED_NORMAL) != 0) return; + if ((_pause_mode & PM_PAUSED_ACTIVE_CLIENTS) != 0) return; - DoCommandP(0, PM_PAUSED_NORMAL, 1, CMD_PAUSE); + DoCommandP(0, PM_PAUSED_ACTIVE_CLIENTS, 1, CMD_PAUSE); NetworkServerSendChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "", CLIENT_ID_SERVER, NETWORK_SERVER_MESSAGE_GAME_PAUSED_PLAYERS); } else { - if ((_pause_mode & PM_PAUSED_NORMAL) == 0) return; + if ((_pause_mode & PM_PAUSED_ACTIVE_CLIENTS) == 0) return; - DoCommandP(0, PM_PAUSED_NORMAL, 0, CMD_PAUSE); + DoCommandP(0, PM_PAUSED_ACTIVE_CLIENTS, 0, CMD_PAUSE); NetworkServerSendChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "", CLIENT_ID_SERVER, NETWORK_SERVER_MESSAGE_GAME_UNPAUSED_PLAYERS); } } diff --git a/src/openttd.h b/src/openttd.h index 0b06be7229..7dc3f55799 100644 --- a/src/openttd.h +++ b/src/openttd.h @@ -51,11 +51,12 @@ extern bool _exit_game; /** Modes of pausing we've got */ enum PauseMode { - PM_UNPAUSED = 0, ///< A normal unpaused game - PM_PAUSED_NORMAL = 1 << 0, ///< A game normally paused - PM_PAUSED_SAVELOAD = 1 << 1, ///< A game paused for saving/loading - PM_PAUSED_JOIN = 1 << 2, ///< A game paused for 'pause on join' - PM_PAUSED_ERROR = 1 << 3, ///< A game paused because a (critical) error + PM_UNPAUSED = 0, ///< A normal unpaused game + PM_PAUSED_NORMAL = 1 << 0, ///< A game normally paused + PM_PAUSED_SAVELOAD = 1 << 1, ///< A game paused for saving/loading + PM_PAUSED_JOIN = 1 << 2, ///< A game paused for 'pause_on_join' + PM_PAUSED_ERROR = 1 << 3, ///< A game paused because a (critical) error + PM_PAUSED_ACTIVE_CLIENTS = 1 << 4, ///< A game paused for 'min_active_clients' }; DECLARE_ENUM_AS_BIT_SET(PauseMode); typedef SimpleTinyEnumT PauseModeByte;