diff options
author | rubidium <rubidium@openttd.org> | 2009-11-12 20:33:30 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-11-12 20:33:30 +0000 |
commit | 2a1cab4d46260dfe7930503ca0c3e45f1679269f (patch) | |
tree | d780cba22549f152f6524671b198c6abf30becbf /src/misc_cmd.cpp | |
parent | 934e6a295d16055d1bcc6ffbbdf6f2b89d36bbe6 (diff) | |
download | openttd-2a1cab4d46260dfe7930503ca0c3e45f1679269f.tar.xz |
(svn r18052) -Codechange/Fix: make the 'pause' chat message when actually executing the pause command. This to prevent showing paused and especially unpaused to be shown when the state doesn't change. Output now mentions whether pause changes keep the game paused and what reasons for pausing there 'currently' are.
Diffstat (limited to 'src/misc_cmd.cpp')
-rw-r--r-- | src/misc_cmd.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp index ee46928c3..cc15bb8f5 100644 --- a/src/misc_cmd.cpp +++ b/src/misc_cmd.cpp @@ -16,6 +16,7 @@ #include "window_func.h" #include "textbuf_gui.h" #include "network/network.h" +#include "network/network_func.h" #include "company_manager_face.h" #include "strings_func.h" #include "gfx_func.h" @@ -329,10 +330,11 @@ static void AskUnsafeUnpauseCallback(Window *w, bool confirmed) DoCommandP(0, PM_PAUSED_ERROR, confirmed ? 0 : 1, CMD_PAUSE); } -/** Pause/Unpause the game (server-only). - * Increase or decrease the pause counter. If the counter is zero, - * the game is unpaused. A counter is used instead of a boolean value - * to have more control over the game when saving/loading, etc. +/** + * Pause/Unpause the game (server-only). + * Set or unset a bit in the pause mode. If pause mode is zero the game is + * unpaused. A bitset is used instead of a boolean value/counter to have + * more control over the game when saving/loading, etc. * @param tile unused * @param flags operation to perform * @param p1 the pause mode to change @@ -353,7 +355,7 @@ CommandCost CmdPause(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, case PM_PAUSED_ACTIVE_CLIENTS: if (!_networking) return CMD_ERROR; break; -#endif +#endif /* ENABLE_NETWORK */ default: return CMD_ERROR; } @@ -366,11 +368,19 @@ CommandCost CmdPause(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, AskUnsafeUnpauseCallback ); } else { +#ifdef ENABLE_NETWORK + PauseMode prev_mode = _pause_mode; +#endif /* ENABLE_NETWORK */ + if (p2 == 0) { _pause_mode = _pause_mode & ~p1; } else { _pause_mode = _pause_mode | p1; } + +#ifdef ENABLE_NETWORK + NetworkHandlePauseChange(prev_mode, (PauseMode)p1); +#endif /* ENABLE_NETWORK */ } SetWindowDirty(WC_STATUS_BAR, 0); |