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
commitafddfcb2b1a37358459158ce83a64535f13cd05e (patch)
tree5fc12b987e4ccf94d7c727fd7c3eccc1826b870a /src/network/network_chat_gui.cpp
parent94dd23aaf86cb1c22ce78d8555261d045de0ee60 (diff)
downloadopenttd-afddfcb2b1a37358459158ce83a64535f13cd05e.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 */