mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-07 06:46:43 +00:00
(svn r8118) -Codechange: change the ordering of the network list a little:
- servers we have information about go above servers we do not have information about. - servers that are version compatible go above servers we are not version compatible with. - servers we have all required NewGRFs for go above servers we miss NewGRFs for. - unpassworded servers go above passworded servers.
This commit is contained in:
parent
96ea43d1b2
commit
468f53911d
@ -142,10 +142,17 @@ static int CDECL NGameAllowedSorter(const void *a, const void *b)
|
|||||||
{
|
{
|
||||||
const NetworkGameList *cmp1 = *(const NetworkGameList**)a;
|
const NetworkGameList *cmp1 = *(const NetworkGameList**)a;
|
||||||
const NetworkGameList *cmp2 = *(const NetworkGameList**)b;
|
const NetworkGameList *cmp2 = *(const NetworkGameList**)b;
|
||||||
/* Reverse default as we are interested in compatible clients first */
|
|
||||||
int r = cmp2->info.compatible - cmp1->info.compatible;
|
|
||||||
|
|
||||||
|
/* The servers we do not know anything about (the ones that did not reply) should be at the bottom) */
|
||||||
|
int r = StrEmpty(cmp1->info.server_revision) - StrEmpty(cmp2->info.server_revision);
|
||||||
|
|
||||||
|
/* Reverse default as we are interested in version-compatible clients first */
|
||||||
|
if (r == 0) r = cmp2->info.version_compatible - cmp1->info.version_compatible;
|
||||||
|
/* The version-compatible ones are then sorted with NewGRF compatible first, incompatible last */
|
||||||
|
if (r == 0) r = cmp2->info.compatible - cmp1->info.compatible;
|
||||||
|
/* Passworded servers should be below unpassworded servers */
|
||||||
if (r == 0) r = cmp1->info.use_password - cmp2->info.use_password;
|
if (r == 0) r = cmp1->info.use_password - cmp2->info.use_password;
|
||||||
|
/* Finally sort on the name of the server */
|
||||||
if (r == 0) r = strcasecmp(cmp1->info.server_name, cmp2->info.server_name);
|
if (r == 0) r = strcasecmp(cmp1->info.server_name, cmp2->info.server_name);
|
||||||
|
|
||||||
return _internal_sort_order ? -r : r;
|
return _internal_sort_order ? -r : r;
|
||||||
|
Loading…
Reference in New Issue
Block a user