Server list changes

This commit is contained in:
Federico Cecchetto 2022-07-06 17:03:21 +02:00
parent a3554662e3
commit 61d66e7998

View File

@ -143,8 +143,9 @@ namespace server_list
if (column == 2)
{
return utils::string::va("%d/%d [%d]", servers[i].clients, servers[index].max_clients,
servers[i].bots);
const auto client_count = servers[i].clients - servers[i].bots;
return utils::string::va("%d/%d [%d]", client_count, servers[i].max_clients,
servers[i].clients);
}
if (column == 3)
@ -168,6 +169,11 @@ namespace server_list
void sort_serverlist()
{
std::stable_sort(servers.begin(), servers.end(), [](const server_info& a, const server_info& b)
{
const auto a_players = a.clients - a.bots;
const auto b_players = b.clients - b.bots;
if (a_players == b_players)
{
if (a.clients == b.clients)
{
@ -175,6 +181,9 @@ namespace server_list
}
return a.clients > b.clients;
}
return a_players > b_players;
});
}