diff options
author | Darkvater <darkvater@openttd.org> | 2006-10-18 13:17:46 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2006-10-18 13:17:46 +0000 |
commit | 68314cf576b7c28e1132d9d640af2205c0484ff1 (patch) | |
tree | 1be40857750c8b591b52bf5cf52bc3ba767fa093 /network_gui.c | |
parent | ccc1ad52d9222e70f1585f83d61ee0a1281681f6 (diff) | |
download | openttd-68314cf576b7c28e1132d9d640af2205c0484ff1.tar.xz |
(svn r6820) -Codechange: Some more const correctness, coding style.
-Codechange: Add FOR_ALL_ACTIVE_CLIENT_INFOS macro that will loop all clients
skipping inactive ones.
Diffstat (limited to 'network_gui.c')
-rw-r--r-- | network_gui.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/network_gui.c b/network_gui.c index fdfc66898..34607c7d0 100644 --- a/network_gui.c +++ b/network_gui.c @@ -1048,9 +1048,7 @@ static const NetworkClientInfo *NetworkFindClientInfo(byte client_no) { const NetworkClientInfo *ci; - for (ci = _network_client_info; ci != &_network_client_info[MAX_CLIENT_INFO]; ci++) { - // Skip non-active items - if (ci->client_index == NETWORK_EMPTY_INDEX) continue; + FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { if (client_no == 0) return ci; client_no--; } @@ -1123,12 +1121,10 @@ static void HandleClientListPopupClick(byte index, byte clientno) { static bool CheckClientListHeight(Window *w) { int num = 0; - NetworkClientInfo *ci; + const NetworkClientInfo *ci; // Should be replaced with a loop through all clients - for (ci = _network_client_info; ci != &_network_client_info[MAX_CLIENT_INFO]; ci++) { - // Skip non-active items - if (ci->client_index == NETWORK_EMPTY_INDEX) continue; + FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { num++; } @@ -1307,10 +1303,7 @@ static void ClientListWndProc(Window *w, WindowEvent *e) y = CLNWND_OFFSET; - for (ci = _network_client_info; ci != &_network_client_info[MAX_CLIENT_INFO]; ci++) { - // Skip non-active items - if (ci->client_index == NETWORK_EMPTY_INDEX) continue; - + FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { if (_selected_clientlist_item == i++) { // Selected item, highlight it GfxFillRect(1, y, 248, y + CLNWND_ROWSIZE - 1, 0); colour = 0xC; |