summaryrefslogtreecommitdiff
path: root/src/network/network_chat_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-12-23 20:52:27 +0000
committerrubidium <rubidium@openttd.org>2008-12-23 20:52:27 +0000
commit54f23ed0b3ff2ee72f36e8755b96ffd35e465f8a (patch)
tree5fc12b987e4ccf94d7c727fd7c3eccc1826b870a /src/network/network_chat_gui.cpp
parent258ebb81732d24f67b66978b12e74dd0d8855433 (diff)
downloadopenttd-54f23ed0b3ff2ee72f36e8755b96ffd35e465f8a.tar.xz
(svn r14730) -Codechange: remove the need for networkclientsockets and networkclientinfo structs to be in a contiguous piece of memory and put them in a pool.
-Note: 255 should really be enough for now... making it any more means network protocol bumps.
Diffstat (limited to 'src/network/network_chat_gui.cpp')
-rw-r--r--src/network/network_chat_gui.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index fc36bec53..4f4447779 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -301,8 +301,13 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
/* First, try clients */
if (*item < MAX_CLIENT_SLOTS) {
/* Skip inactive clients */
- while (GetNetworkClientInfo(*item)->client_id == INVALID_CLIENT_ID && *item < MAX_CLIENT_SLOTS) (*item)++;
- if (*item < MAX_CLIENT_SLOTS) return GetNetworkClientInfo(*item)->client_name;
+ NetworkClientInfo *ci;
+ FOR_ALL_CLIENT_INFOS_FROM(ci, *item + 1) break;
+ if (ci != NULL) {
+ *item = ci->index;
+ return ci->client_name;
+ }
+ *item = MAX_CLIENT_SLOTS;
}
/* Then, try townnames */