mirror of https://github.com/OpenTTD/OpenTTD
(svn r22363) -Codechange: NetworkFindClientStateFromClientID -> NetworkClientSocket::GetByClientID
parent
bc9a803ea9
commit
f1d0c1a746
|
@ -124,7 +124,7 @@ NetworkClientInfo::~NetworkClientInfo()
|
||||||
* @param client_id the ClientID to search for
|
* @param client_id the ClientID to search for
|
||||||
* @return return a pointer to the corresponding NetworkClientSocket struct or NULL when not found
|
* @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;
|
NetworkClientSocket *cs;
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,6 @@ void NetworkSyncCommandQueue(NetworkClientSocket *cs);
|
||||||
void NetworkError(StringID error_string);
|
void NetworkError(StringID error_string);
|
||||||
void NetworkTextMessage(NetworkAction action, TextColour colour, bool self_send, const char *name, const char *str = "", int64 data = 0);
|
void NetworkTextMessage(NetworkAction action, TextColour colour, bool self_send, const char *name, const char *str = "", int64 data = 0);
|
||||||
uint NetworkCalculateLag(const NetworkClientSocket *cs);
|
uint NetworkCalculateLag(const NetworkClientSocket *cs);
|
||||||
NetworkClientSocket *NetworkFindClientStateFromClientID(ClientID client_id);
|
|
||||||
StringID GetNetworkErrorMsg(NetworkErrorCode err);
|
StringID GetNetworkErrorMsg(NetworkErrorCode err);
|
||||||
bool NetworkFindName(char new_name[NETWORK_CLIENT_NAME_LENGTH]);
|
bool NetworkFindName(char new_name[NETWORK_CLIENT_NAME_LENGTH]);
|
||||||
const char *GenerateCompanyPasswordHash(const char *password, const char *password_server_id, uint32 password_game_seed);
|
const char *GenerateCompanyPasswordHash(const char *password, const char *password_server_id, uint32 password_game_seed);
|
||||||
|
|
|
@ -1890,7 +1890,7 @@ void NetworkServerDoMove(ClientID client_id, CompanyID company_id)
|
||||||
if (client_id == CLIENT_ID_SERVER) {
|
if (client_id == CLIENT_ID_SERVER) {
|
||||||
SetLocalCompany(company_id);
|
SetLocalCompany(company_id);
|
||||||
} else {
|
} else {
|
||||||
NetworkClientSocket *cs = NetworkFindClientStateFromClientID(client_id);
|
NetworkClientSocket *cs = NetworkClientSocket::GetByClientID(client_id);
|
||||||
/* When the company isn't authorized we can't move them yet. */
|
/* When the company isn't authorized we can't move them yet. */
|
||||||
if (cs->status < NetworkClientSocket::STATUS_AUTHORIZED) return;
|
if (cs->status < NetworkClientSocket::STATUS_AUTHORIZED) return;
|
||||||
cs->SendMove(client_id, company_id);
|
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)
|
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)
|
static void NetworkServerSendError(ClientID client_id, NetworkErrorCode error)
|
||||||
{
|
{
|
||||||
NetworkFindClientStateFromClientID(client_id)->SendError(error);
|
NetworkClientSocket::GetByClientID(client_id)->SendError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkServerKickClient(ClientID client_id)
|
void NetworkServerKickClient(ClientID client_id)
|
||||||
|
|
|
@ -115,6 +115,8 @@ public:
|
||||||
{
|
{
|
||||||
return "server";
|
return "server";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ServerNetworkGameSocketHandler *GetByClientID(ClientID client_id);
|
||||||
};
|
};
|
||||||
|
|
||||||
void NetworkServer_Tick(bool send_frame);
|
void NetworkServer_Tick(bool send_frame);
|
||||||
|
|
Loading…
Reference in New Issue