summaryrefslogtreecommitdiff
path: root/command.c
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2005-05-17 20:52:52 +0000
committerDarkvater <Darkvater@openttd.org>2005-05-17 20:52:52 +0000
commit0f7b2b673d5828c6fed6409e978032ecd9ca0585 (patch)
tree568c35c38cb6473dfe6fc2eaf5a5bf49eba6344d /command.c
parent6dbc01529143b054004aec91f706ecdc2299421d (diff)
downloadopenttd-0f7b2b673d5828c6fed6409e978032ecd9ca0585.tar.xz
(svn r2343) - Fix (regression): dedicated server caused desyncs with its commands, because the player sent over the network is OWNER_SPECTATOR as well, which on clients cannot execute anything. So *hack*hack* it into temporarily player 0.
Diffstat (limited to 'command.c')
-rw-r--r--command.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/command.c b/command.c
index 44cb446d1..29ab994fc 100644
--- a/command.c
+++ b/command.c
@@ -476,10 +476,16 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
}
#ifdef ENABLE_NETWORK
- // If we are in network, and the command is not from the network
- // send it to the command-queue and abort execution
+ /** If we are in network, and the command is not from the network
+ * send it to the command-queue and abort execution
+ * If we are a dedicated server temporarily switch local player, otherwise
+ * the other parties won't be able to execute our command and will desync.
+ * @todo Rewrite dedicated server to something more than a dirty hack!
+ */
if (_networking && !(cmd & CMD_NETWORK_COMMAND)) {
+ if (_network_dedicated) _local_player = 0;
NetworkSend_Command(tile, p1, p2, cmd, callback);
+ if (_network_dedicated) _local_player = OWNER_SPECTATOR;
_docommand_recursive = 0;
_cmd_text = NULL;
return true;