From 0b853a659a2c76023389f88ae40938dd5e9f73e7 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Thu, 1 Jun 2017 15:38:56 -0500 Subject: [PATCH] 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). --- code/client/cl_ui.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/code/client/cl_ui.c b/code/client/cl_ui.c index f3fca928..4d2628e5 100644 --- a/code/client/cl_ui.c +++ b/code/client/cl_ui.c @@ -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 {