summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-04-22 15:54:42 +0000
committerrubidium <rubidium@openttd.org>2011-04-22 15:54:42 +0000
commitf1d0c1a74698ad3fc42ed93ba1587160f8a6941a (patch)
tree9a74567395578094d97a7af742de87a7111b92a3
parentbc9a803ea956620574896f95932a9973d7601fdd (diff)
downloadopenttd-f1d0c1a74698ad3fc42ed93ba1587160f8a6941a.tar.xz
(svn r22363) -Codechange: NetworkFindClientStateFromClientID -> NetworkClientSocket::GetByClientID
-rw-r--r--src/network/network.cpp2
-rw-r--r--src/network/network_internal.h1
-rw-r--r--src/network/network_server.cpp6
-rw-r--r--src/network/network_server.h2
4 files changed, 6 insertions, 5 deletions
diff --git a/src/network/network.cpp b/src/network/network.cpp
index c857c0784..81988e83b 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -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;
diff --git a/src/network/network_internal.h b/src/network/network_internal.h
index cd87f1e31..818773256 100644
--- a/src/network/network_internal.h
+++ b/src/network/network_internal.h
@@ -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);
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 142b83b5b..6f3255ce9 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -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)
diff --git a/src/network/network_server.h b/src/network/network_server.h
index 5fda5b257..aa8f6fc13 100644
--- a/src/network/network_server.h
+++ b/src/network/network_server.h
@@ -115,6 +115,8 @@ public:
{
return "server";
}
+
+ static ServerNetworkGameSocketHandler *GetByClientID(ClientID client_id);
};
void NetworkServer_Tick(bool send_frame);