diff options
author | rubidium <rubidium@openttd.org> | 2008-12-22 21:38:03 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-12-22 21:38:03 +0000 |
commit | bdd92008cf1506823baba4d83d4d59b185b3decf (patch) | |
tree | e370db6a1822a7b0bfa9e55ce0a5bafcb588daf2 /src/network/network.cpp | |
parent | 7403790ba4433f99b92a563e7a1a5045e734bef2 (diff) | |
download | openttd-bdd92008cf1506823baba4d83d4d59b185b3decf.tar.xz |
(svn r14718) -Change: remove some direct network core variable accesses from non-network locations.
Diffstat (limited to 'src/network/network.cpp')
-rw-r--r-- | src/network/network.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/network/network.cpp b/src/network/network.cpp index 85da1bb82..2983446fc 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -100,7 +100,21 @@ static ClientID _network_client_id = CLIENT_ID_FIRST; /* Some externs / forwards */ extern void StateGameLoop(); -// Function that looks up the CI for a given client-identifier +/** + * Return the CI given it's raw index + * @param index the index to search for + * @return return a pointer to the corresponding NetworkClientInfo struct + */ +NetworkClientInfo *NetworkFindClientInfoFromIndex(ClientIndex index) +{ + return &_network_client_info[index]; +} + +/** + * Return the CI given it's client-identifier + * @param client_id the ClientID to search for + * @return return a pointer to the corresponding NetworkClientInfo struct or NULL when not found + */ NetworkClientInfo *NetworkFindClientInfoFromClientID(ClientID client_id) { NetworkClientInfo *ci; @@ -112,9 +126,11 @@ NetworkClientInfo *NetworkFindClientInfoFromClientID(ClientID client_id) return NULL; } -/** Return the CI for a given IP +/** + * Return the CI for a given IP * @param ip IP of the client we are looking for. This must be in string-format - * @return return a pointer to the corresponding NetworkClientInfo struct or NULL on failure */ + * @return return a pointer to the corresponding NetworkClientInfo struct or NULL when not found + */ NetworkClientInfo *NetworkFindClientInfoFromIP(const char *ip) { NetworkClientInfo *ci; @@ -127,7 +143,11 @@ NetworkClientInfo *NetworkFindClientInfoFromIP(const char *ip) return NULL; } -// Function that looks up the CS for a given client-identifier +/** + * Return the client state given it's client-identifier + * @param client_id the ClientID to search for + * @return return a pointer to the corresponding NetworkTCPSocketHandler struct or NULL when not found + */ NetworkTCPSocketHandler *NetworkFindClientStateFromClientID(ClientID client_id) { NetworkTCPSocketHandler *cs; |