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 | ddfe8f608f849abef685531d2bd20f8bc8139175 (patch) | |
tree | b3ef1053ca6cfbb64f97af3d577715499c260130 | |
parent | 8b8ef85ccb53a7e06e9e833d889d574eaada554f (diff) | |
download | openttd-ddfe8f608f849abef685531d2bd20f8bc8139175.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); |