diff options
author | Darkvater <darkvater@openttd.org> | 2006-10-17 22:16:46 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2006-10-17 22:16:46 +0000 |
commit | fbc724c6cb0847c765ebc95d0598f608474c7476 (patch) | |
tree | 3c5e7e6bcdb563a73452b3392ed9da9e30aa513c /network_udp.c | |
parent | 821df34b6ea306b19c64555f478910cacc44c48e (diff) | |
download | openttd-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 'network_udp.c')
-rw-r--r-- | network_udp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/network_udp.c b/network_udp.c index 932de9d9e..083c724b1 100644 --- a/network_udp.c +++ b/network_udp.c @@ -214,7 +214,7 @@ DEF_UDP_RECEIVE_COMMAND(PACKET_UDP_CLIENT_DETAIL_INFO) /* Find the clients that are connected to this player */ FOR_ALL_CLIENTS(cs) { ci = DEREF_CLIENT_INFO(cs); - if (ci->client_playas - 1 == player->index) { + if (ci->client_playas == player->index) { /* The uint8 == 1 indicates that a client is following */ NetworkSend_uint8(packet, 1); NetworkSend_string(packet, ci->client_name); @@ -224,7 +224,7 @@ DEF_UDP_RECEIVE_COMMAND(PACKET_UDP_CLIENT_DETAIL_INFO) } /* Also check for the server itself */ ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX); - if (ci->client_playas - 1 == player->index) { + if (ci->client_playas == player->index) { /* The uint8 == 1 indicates that a client is following */ NetworkSend_uint8(packet, 1); NetworkSend_string(packet, ci->client_name); @@ -239,7 +239,7 @@ DEF_UDP_RECEIVE_COMMAND(PACKET_UDP_CLIENT_DETAIL_INFO) /* And check if we have any spectators */ FOR_ALL_CLIENTS(cs) { ci = DEREF_CLIENT_INFO(cs); - if (ci->client_playas - 1 > MAX_PLAYERS) { + if (!IsValidPlayer(ci->client_playas)) { /* The uint8 == 1 indicates that a client is following */ NetworkSend_uint8(packet, 1); NetworkSend_string(packet, ci->client_name); @@ -249,7 +249,7 @@ DEF_UDP_RECEIVE_COMMAND(PACKET_UDP_CLIENT_DETAIL_INFO) } /* Also check for the server itself */ ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX); - if (ci->client_playas - 1 > MAX_PLAYERS) { + if (!IsValidPlayer(ci->client_playas)) { /* The uint8 == 1 indicates that a client is following */ NetworkSend_uint8(packet, 1); NetworkSend_string(packet, ci->client_name); |