summaryrefslogtreecommitdiff
path: root/players.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-10-17 22:16:46 +0000
committerDarkvater <darkvater@openttd.org>2006-10-17 22:16:46 +0000
commitfbc724c6cb0847c765ebc95d0598f608474c7476 (patch)
tree3c5e7e6bcdb563a73452b3392ed9da9e30aa513c /players.c
parent821df34b6ea306b19c64555f478910cacc44c48e (diff)
downloadopenttd-fbc724c6cb0847c765ebc95d0598f608474c7476.tar.xz
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
correctly handle this ci->client_playas - 1 was used all over the code making it pretty confusing at times. Use proper one-on-one values now. Special handling is only needed for user-output to not to confuse users.
Diffstat (limited to 'players.c')
-rw-r--r--players.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/players.c b/players.c
index 720b5cd70..d343f43aa 100644
--- a/players.c
+++ b/players.c
@@ -854,10 +854,10 @@ int32 CmdPlayerCtrl(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
* server-side in network_server.c:838, function
* DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND) */
NetworkClientInfo *ci = &_network_client_info[cid];
- ci->client_playas = p->index + 1;
+ ci->client_playas = p->index;
NetworkUpdateClientInfo(ci->client_index);
- if (ci->client_playas != 0 && ci->client_playas <= MAX_PLAYERS) {
+ if (IsValidPlayer(ci->client_playas)) {
PlayerID player_backup = _local_player;
_network_player_info[p->index].months_empty = 0;
@@ -873,7 +873,7 @@ int32 CmdPlayerCtrl(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
* with joining to let it send itself the command, and not the server?
* For example in network_client.c:534? */
_cmd_text = ci->client_name;
- _local_player = ci->client_playas - 1;
+ _local_player = ci->client_playas;
NetworkSend_Command(0, 0, 0, CMD_CHANGE_PRESIDENT_NAME, NULL);
_local_player = player_backup;
}