summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-11-30 22:23:11 +0000
committerDarkvater <darkvater@openttd.org>2006-11-30 22:23:11 +0000
commit9b4d3ff4b88eb6d655bf31afc28a6afa849f07f7 (patch)
tree2c9f331ba6215aeac6bbfa1823ee54ac7f4d0c7a
parentaf017c198c99e5f4c16fadcfd66962bd8a26d874 (diff)
downloadopenttd-9b4d3ff4b88eb6d655bf31afc28a6afa849f07f7.tar.xz
(svn r7312) -Fix: When loading a game from a dedicated server the local player global variable was
wrongly set to 0. In theory this allowed a dedicated server to also play. I see no history for this bug, but it has been there since the introduction of the dedicated server probably. Thanks peter1138 for bringing it to my attention and thanks myself for rewriting the code so this bug could surface ;p
-rw-r--r--openttd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/openttd.c b/openttd.c
index 09b0f9496..7d30e3ac3 100644
--- a/openttd.c
+++ b/openttd.c
@@ -759,7 +759,9 @@ void SwitchMode(int new_mode)
LoadIntroGame();
ShowErrorMessage(INVALID_STRING_ID, STR_4009_GAME_LOAD_FAILED, 0, 0);
} else {
- _local_player = 0;
+ /* Update the local player for a loaded game. It is either always
+ * player #1 (eg 0) or in the case of a dedicated server a spectator */
+ _local_player = _network_dedicated ? PLAYER_SPECTATOR : 0;
DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // decrease pause counter (was increased from opening load dialog)
#ifdef ENABLE_NETWORK
if (_network_server) {