(svn r22363) -Codechange: NetworkFindClientStateFromClientID -> NetworkClientSocket::GetByClientID

This commit is contained in:
rubidium 2011-04-22 15:54:42 +00:00
parent bc9a803ea9
commit f1d0c1a746
4 changed files with 6 additions and 5 deletions

View File

@ -124,7 +124,7 @@ NetworkClientInfo::~NetworkClientInfo()
* @param client_id the ClientID to search for
* @return return a pointer to the corresponding NetworkClientSocket struct or NULL when not found
*/
NetworkClientSocket *NetworkFindClientStateFromClientID(ClientID client_id)
/* static */ NetworkClientSocket *NetworkClientSocket::GetByClientID(ClientID client_id)
{
NetworkClientSocket *cs;

View File

@ -164,7 +164,6 @@ void NetworkSyncCommandQueue(NetworkClientSocket *cs);
void NetworkError(StringID error_string);
void NetworkTextMessage(NetworkAction action, TextColour colour, bool self_send, const char *name, const char *str = "", int64 data = 0);
uint NetworkCalculateLag(const NetworkClientSocket *cs);
NetworkClientSocket *NetworkFindClientStateFromClientID(ClientID client_id);
StringID GetNetworkErrorMsg(NetworkErrorCode err);
bool NetworkFindName(char new_name[NETWORK_CLIENT_NAME_LENGTH]);
const char *GenerateCompanyPasswordHash(const char *password, const char *password_server_id, uint32 password_game_seed);

View File

@ -1890,7 +1890,7 @@ void NetworkServerDoMove(ClientID client_id, CompanyID company_id)
if (client_id == CLIENT_ID_SERVER) {
SetLocalCompany(company_id);
} else {
NetworkClientSocket *cs = NetworkFindClientStateFromClientID(client_id);
NetworkClientSocket *cs = NetworkClientSocket::GetByClientID(client_id);
/* When the company isn't authorized we can't move them yet. */
if (cs->status < NetworkClientSocket::STATUS_AUTHORIZED) return;
cs->SendMove(client_id, company_id);
@ -1905,12 +1905,12 @@ void NetworkServerDoMove(ClientID client_id, CompanyID company_id)
void NetworkServerSendRcon(ClientID client_id, TextColour colour_code, const char *string)
{
NetworkFindClientStateFromClientID(client_id)->SendRConResult(colour_code, string);
NetworkClientSocket::GetByClientID(client_id)->SendRConResult(colour_code, string);
}
static void NetworkServerSendError(ClientID client_id, NetworkErrorCode error)
{
NetworkFindClientStateFromClientID(client_id)->SendError(error);
NetworkClientSocket::GetByClientID(client_id)->SendError(error);
}
void NetworkServerKickClient(ClientID client_id)

View File

@ -115,6 +115,8 @@ public:
{
return "server";
}
static ServerNetworkGameSocketHandler *GetByClientID(ClientID client_id);
};
void NetworkServer_Tick(bool send_frame);