mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-12-13 21:51:09 +00:00
Make Team Arena server list sub-sort clients by max clients
The player column in Team Arena UI lists clients and max clients in format of "clients [maxclients]". When sorting by clients the max clients is ignored which results in player column being disorganized. When servers have the same number of clients, sort based on max clients. Otherwise client sort is sub-sorted based on order of getinfo responses (ping).
This commit is contained in:
parent
2bbe178bc8
commit
0b853a659a
1 changed files with 12 additions and 2 deletions
|
@ -374,6 +374,7 @@ LAN_CompareServers
|
|||
static int LAN_CompareServers( int source, int sortKey, int sortDir, int s1, int s2 ) {
|
||||
int res;
|
||||
serverInfo_t *server1, *server2;
|
||||
int clients1, clients2;
|
||||
|
||||
server1 = LAN_GetServerPtr(source, s1);
|
||||
server2 = LAN_GetServerPtr(source, s2);
|
||||
|
@ -391,10 +392,19 @@ static int LAN_CompareServers( int source, int sortKey, int sortDir, int s1, int
|
|||
res = Q_stricmp( server1->mapName, server2->mapName );
|
||||
break;
|
||||
case SORT_CLIENTS:
|
||||
if (server1->clients < server2->clients) {
|
||||
// sub sort by max clients
|
||||
if ( server1->clients == server2->clients ) {
|
||||
clients1 = server1->maxClients;
|
||||
clients2 = server2->maxClients;
|
||||
} else {
|
||||
clients1 = server1->clients;
|
||||
clients2 = server2->clients;
|
||||
}
|
||||
|
||||
if (clients1 < clients2) {
|
||||
res = -1;
|
||||
}
|
||||
else if (server1->clients > server2->clients) {
|
||||
else if (clients1 > clients2) {
|
||||
res = 1;
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in a new issue