(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.
This commit is contained in:
Darkvater
2006-10-17 22:16:46 +00:00
parent 821df34b6e
commit fbc724c6cb
10 changed files with 79 additions and 83 deletions

View File

@@ -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);