diff options
author | Darkvater <darkvater@openttd.org> | 2006-11-10 17:52:51 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2006-11-10 17:52:51 +0000 |
commit | 73ca5faa2efe6abd28aadacbccf9d5a02f13c7a3 (patch) | |
tree | 6abf7ee63a84078c6b20f1f317de5a1483ccf058 /command.c | |
parent | 82f7140357b8b13e5f3c2eea715af936e5debb28 (diff) | |
download | openttd-73ca5faa2efe6abd28aadacbccf9d5a02f13c7a3.tar.xz |
(svn r7125) -Fix: Several errors/glitches related to multiplayer and bankrupcy, mainly such a
thing happening to a server, and non updated company-information. Also fixes FS#393.
Diffstat (limited to 'command.c')
-rw-r--r-- | command.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -424,9 +424,9 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, error_part1 = GB(cmd, 16, 16); _additional_cash_required = 0; - /** Spectator has no rights except for the dedicated server which - * is a spectator but is the server, so can do anything */ - if (_current_player == PLAYER_SPECTATOR && !_network_dedicated) { + /** Spectator has no rights except for the (dedicated) server which + * is/can be a spectator but as the server it can do anything */ + if (_current_player == PLAYER_SPECTATOR && !_network_server) { ShowErrorMessage(_error_message, error_part1, x, y); _cmd_text = NULL; return false; @@ -495,12 +495,14 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, * 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! + * We also need to do this if the server's company has gone bankrupt + * @todo Rewrite (dedicated) server to something more than a dirty hack! */ if (_networking && !(cmd & CMD_NETWORK_COMMAND)) { - if (_network_dedicated) _local_player = 0; + PlayerID pbck = _local_player; + if (_network_dedicated || (_network_server && pbck == PLAYER_SPECTATOR)) _local_player = 0; NetworkSend_Command(tile, p1, p2, cmd, callback); - if (_network_dedicated) _local_player = PLAYER_SPECTATOR; + if (_network_dedicated || (_network_server && pbck == PLAYER_SPECTATOR)) _local_player = pbck; _docommand_recursive = 0; _cmd_text = NULL; return true; |