diff options
author | Darkvater <Darkvater@openttd.org> | 2006-01-29 20:24:18 +0000 |
---|---|---|
committer | Darkvater <Darkvater@openttd.org> | 2006-01-29 20:24:18 +0000 |
commit | 3f7cb3d0ebb636c68d5d0b0529614157dc32a314 (patch) | |
tree | b3ef1053ca6cfbb64f97af3d577715499c260130 | |
parent | a33a7bc4f80290e55d75ce8efc9d0350cb329ae8 (diff) | |
download | openttd-3f7cb3d0ebb636c68d5d0b0529614157dc32a314.tar.xz |
(svn r3478) - Fix: In the network game list do the default sorting on connectivity (so servers which you can join are on top) and sort on names as a second criteria on clients and connectivity.
-rw-r--r-- | network_gui.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/network_gui.c b/network_gui.c index 80830fa00..0f6a6980f 100644 --- a/network_gui.c +++ b/network_gui.c @@ -131,6 +131,7 @@ static int CDECL NGameClientSorter(const void *a, const void *b) int r = cmp2->info.clients_on - cmp1->info.clients_on; if (r == 0) r = cmp1->info.clients_max - cmp2->info.clients_max; + if (r == 0) r = strcasecmp(cmp1->info.server_name, cmp2->info.server_name); return (_internal_sort_order & 1) ? -r : r; } @@ -145,6 +146,7 @@ static int CDECL NGameAllowedSorter(const void *a, const void *b) int r = cmp2->info.compatible - cmp1->info.compatible; if (r == 0) r = cmp1->info.use_password - cmp2->info.use_password; + if (r == 0) r = strcasecmp(cmp1->info.server_name, cmp2->info.server_name); return (_internal_sort_order & 1) ? -r : r; } @@ -540,20 +542,23 @@ static const WindowDesc _network_game_window_desc = { void ShowNetworkGameWindow(void) { - static bool _first_time_show_network_game_window = true; + static bool first = true; Window *w; querystr_d *querystr; DeleteWindowById(WC_NETWORK_WINDOW, 0); /* Only show once */ - if (_first_time_show_network_game_window) { + if (first) { char* const *srv; - _first_time_show_network_game_window = false; + first = false; // add all servers from the config file to our list for (srv = &_network_host_list[0]; srv != endof(_network_host_list) && *srv != NULL; srv++) { NetworkAddServer(*srv); } + + _ng_sorting.criteria = 2; // sort default by collectivity (green-dots on top) + _ng_sorting.order = 0; // sort ascending by default } w = AllocateWindowDesc(&_network_game_window_desc); |