diff options
author | rubidium <rubidium@openttd.org> | 2008-12-22 21:30:21 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-12-22 21:30:21 +0000 |
commit | f49cc67f83ca08f9b319f85ec1b5db7f1fbb1b20 (patch) | |
tree | c1c710f0339790ab0ef9bbfed4f662d520e1ba1e /src/network | |
parent | 573d1b324a1b919efa76763c94bdf3075bd2bfa8 (diff) | |
download | openttd-f49cc67f83ca08f9b319f85ec1b5db7f1fbb1b20.tar.xz |
(svn r14717) -Change: more 'Index' -> ClientID to not confuse ClientID and ClientIndex
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/network.cpp | 2 | ||||
-rw-r--r-- | src/network/network_client.cpp | 18 | ||||
-rw-r--r-- | src/network/network_func.h | 2 | ||||
-rw-r--r-- | src/network/network_server.cpp | 24 |
4 files changed, 23 insertions, 23 deletions
diff --git a/src/network/network.cpp b/src/network/network.cpp index b48b5535e..85da1bb82 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -101,7 +101,7 @@ static ClientID _network_client_id = CLIENT_ID_FIRST; extern void StateGameLoop(); // Function that looks up the CI for a given client-identifier -NetworkClientInfo *NetworkFindClientInfoFromIndex(ClientID client_id) +NetworkClientInfo *NetworkFindClientInfoFromClientID(ClientID client_id) { NetworkClientInfo *ci; diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index 6f14efd80..987614ca7 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -401,7 +401,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CLIENT_INFO) /* Do we receive a change of data? Most likely we changed playas */ if (client_id == _network_own_client_id) _network_playas = playas; - ci = NetworkFindClientInfoFromIndex(client_id); + ci = NetworkFindClientInfoFromClientID(client_id); if (ci != NULL) { if (playas == ci->client_playas && strcmp(name, ci->client_name) != 0) { // Client name changed, display the change @@ -420,7 +420,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CLIENT_INFO) } // We don't have this client_id yet, find an empty client_id, and put the data there - ci = NetworkFindClientInfoFromIndex(INVALID_CLIENT_ID); + ci = NetworkFindClientInfoFromClientID(INVALID_CLIENT_ID); if (ci != NULL) { ci->client_id = client_id; ci->client_playas = playas; @@ -714,7 +714,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CHAT) bool self_send = p->Recv_bool(); p->Recv_string(msg, NETWORK_CHAT_LENGTH); - ci_to = NetworkFindClientInfoFromIndex(client_id); + ci_to = NetworkFindClientInfoFromClientID(client_id); if (ci_to == NULL) return NETWORK_RECV_STATUS_OKAY; /* Did we initiate the action locally? */ @@ -723,7 +723,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CHAT) case NETWORK_ACTION_CHAT_CLIENT: /* For speaking to client we need the client-name */ snprintf(name, sizeof(name), "%s", ci_to->client_name); - ci = NetworkFindClientInfoFromIndex(_network_own_client_id); + ci = NetworkFindClientInfoFromClientID(_network_own_client_id); break; /* For speaking to company or giving money, we need the company-name */ @@ -735,7 +735,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CHAT) SetDParam(0, ci_to->client_playas); GetString(name, str, lastof(name)); - ci = NetworkFindClientInfoFromIndex(_network_own_client_id); + ci = NetworkFindClientInfoFromClientID(_network_own_client_id); } break; default: NOT_REACHED(); break; @@ -759,7 +759,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_ERROR_QUIT) ClientID client_id = (ClientID)p->Recv_uint32(); GetNetworkErrorMsg(str, (NetworkErrorCode)p->Recv_uint8(), lastof(str)); - ci = NetworkFindClientInfoFromIndex(client_id); + ci = NetworkFindClientInfoFromClientID(client_id); if (ci != NULL) { NetworkTextMessage(NETWORK_ACTION_LEAVE, CC_DEFAULT, false, ci->client_name, "%s", str); @@ -780,7 +780,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_QUIT) ClientID client_id = (ClientID)p->Recv_uint32(); p->Recv_string(str, lengthof(str)); - ci = NetworkFindClientInfoFromIndex(client_id); + ci = NetworkFindClientInfoFromClientID(client_id); if (ci != NULL) { NetworkTextMessage(NETWORK_ACTION_LEAVE, CC_DEFAULT, false, ci->client_name, "%s", str); @@ -800,7 +800,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_JOIN) { ClientID client_id = (ClientID)p->Recv_uint32(); - NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(client_id); + NetworkClientInfo *ci = NetworkFindClientInfoFromClientID(client_id); if (ci != NULL) NetworkTextMessage(NETWORK_ACTION_JOIN, CC_DEFAULT, false, ci->client_name, ""); @@ -928,7 +928,7 @@ void NetworkClientSendRcon(const char *password, const char *command) void NetworkUpdateClientName() { - NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(_network_own_client_id); + NetworkClientInfo *ci = NetworkFindClientInfoFromClientID(_network_own_client_id); if (ci == NULL) return; diff --git a/src/network/network_func.h b/src/network/network_func.h index e79d7926f..f5bcff496 100644 --- a/src/network/network_func.h +++ b/src/network/network_func.h @@ -51,7 +51,7 @@ void NetworkServerChangeOwner(Owner current_owner, Owner new_owner); void NetworkServerShowStatusToConsole(); bool NetworkServerStart(); -NetworkClientInfo *NetworkFindClientInfoFromIndex(ClientID client_id); +NetworkClientInfo *NetworkFindClientInfoFromClientID(ClientID client_id); NetworkClientInfo *NetworkFindClientInfoFromIP(const char *ip); const char* GetClientIP(const NetworkClientInfo *ci); diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index eb371443d..d0f098e1e 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -79,7 +79,7 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_COMPANY_INFO) memset(clients, 0, sizeof(clients)); /* Add the local player (if not dedicated) */ - const NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(CLIENT_ID_SERVER); + const NetworkClientInfo *ci = NetworkFindClientInfoFromClientID(CLIENT_ID_SERVER); if (ci != NULL && IsValidCompanyID(ci->client_playas)) { strecpy(clients[ci->client_playas], ci->client_name, lastof(clients[ci->client_playas])); } @@ -258,7 +258,7 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_WELCOME) SEND_COMMAND(PACKET_SERVER_CLIENT_INFO)(cs, DEREF_CLIENT_INFO(new_cs)); } // Also send the info of the server - SEND_COMMAND(PACKET_SERVER_CLIENT_INFO)(cs, NetworkFindClientInfoFromIndex(CLIENT_ID_SERVER)); + SEND_COMMAND(PACKET_SERVER_CLIENT_INFO)(cs, NetworkFindClientInfoFromClientID(CLIENT_ID_SERVER)); } DEF_SERVER_SEND_COMMAND(PACKET_SERVER_WAIT) @@ -1057,7 +1057,7 @@ void NetworkServerSendChat(NetworkAction action, DestType desttype, int dest, co case DESTTYPE_CLIENT: /* Are we sending to the server? */ if ((ClientID)dest == CLIENT_ID_SERVER) { - ci = NetworkFindClientInfoFromIndex(from_id); + ci = NetworkFindClientInfoFromClientID(from_id); /* Display the text locally, and that is it */ if (ci != NULL) NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColor(ci->client_playas), false, ci->client_name, "%s", msg); @@ -1074,8 +1074,8 @@ void NetworkServerSendChat(NetworkAction action, DestType desttype, int dest, co // Display the message locally (so you know you have sent it) if (from_id != (ClientID)dest) { if (from_id == CLIENT_ID_SERVER) { - ci = NetworkFindClientInfoFromIndex(from_id); - ci_to = NetworkFindClientInfoFromIndex((ClientID)dest); + ci = NetworkFindClientInfoFromClientID(from_id); + ci_to = NetworkFindClientInfoFromClientID((ClientID)dest); if (ci != NULL && ci_to != NULL) NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColor(ci->client_playas), true, ci_to->client_name, "%s", msg); } else { @@ -1102,8 +1102,8 @@ void NetworkServerSendChat(NetworkAction action, DestType desttype, int dest, co } } - ci = NetworkFindClientInfoFromIndex(from_id); - ci_own = NetworkFindClientInfoFromIndex(CLIENT_ID_SERVER); + ci = NetworkFindClientInfoFromClientID(from_id); + ci_own = NetworkFindClientInfoFromClientID(CLIENT_ID_SERVER); if (ci != NULL && ci_own != NULL && ci_own->client_playas == dest) { NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColor(ci->client_playas), false, ci->client_name, "%s", msg); if (from_id == CLIENT_ID_SERVER) show_local = false; @@ -1138,7 +1138,7 @@ void NetworkServerSendChat(NetworkAction action, DestType desttype, int dest, co FOR_ALL_CLIENTS(cs) { SEND_COMMAND(PACKET_SERVER_CHAT)(cs, action, from_id, false, msg); } - ci = NetworkFindClientInfoFromIndex(from_id); + ci = NetworkFindClientInfoFromClientID(from_id); if (ci != NULL) NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColor(ci->client_playas), false, ci->client_name, "%s", msg); break; @@ -1336,7 +1336,7 @@ void NetworkPopulateCompanyStats(NetworkCompanyStats *stats) void NetworkUpdateClientInfo(ClientID client_id) { NetworkTCPSocketHandler *cs; - NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(client_id); + NetworkClientInfo *ci = NetworkFindClientInfoFromClientID(client_id); if (ci == NULL) return; @@ -1378,7 +1378,7 @@ static void NetworkAutoCleanCompanies() } if (!_network_dedicated) { - ci = NetworkFindClientInfoFromIndex(CLIENT_ID_SERVER); + ci = NetworkFindClientInfoFromClientID(CLIENT_ID_SERVER); if (IsValidCompanyID(ci->client_playas)) clients_in_company[ci->client_playas] = true; } @@ -1436,7 +1436,7 @@ bool NetworkFindName(char new_name[NETWORK_CLIENT_NAME_LENGTH]) } } // Check if it is the same as the server-name - ci = NetworkFindClientInfoFromIndex(CLIENT_ID_SERVER); + ci = NetworkFindClientInfoFromClientID(CLIENT_ID_SERVER); if (ci != NULL) { if (strcmp(ci->client_name, new_name) == 0) found_name = false; // name already in use } @@ -1570,7 +1570,7 @@ void NetworkServerChangeOwner(Owner current_owner, Owner new_owner) /* The server has to handle all administrative issues, for example * updating and notifying all clients of what has happened */ NetworkTCPSocketHandler *cs; - NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(CLIENT_ID_SERVER); + NetworkClientInfo *ci = NetworkFindClientInfoFromClientID(CLIENT_ID_SERVER); /* The server has just changed from owner */ if (current_owner == ci->client_playas) { |