[ServerList] Display bots separately

This commit is contained in:
momo5502 2017-06-12 21:01:56 +02:00
parent bd3c4c8aa1
commit d096a47f48
3 changed files with 7 additions and 2 deletions

View File

@ -295,6 +295,7 @@ namespace Components
// Basic info handler
Network::Handle("getInfo", [] (Network::Address address, std::string data)
{
int botCount = 0;
int clientCount = 0;
int maxclientCount = *Game::svs_numclients;
@ -304,7 +305,8 @@ namespace Components
{
if (Game::svs_clients[i].state >= 3)
{
++clientCount;
if (Game::svs_clients[i].isBot) ++botCount;
else ++clientCount;
}
}
}
@ -323,6 +325,7 @@ namespace Components
info.set("fs_game", Dvar::Var("fs_game").get<const char*>());
info.set("xuid", Utils::String::VA("%llX", Steam::SteamUser()->GetSteamID().bits));
info.set("clients", Utils::String::VA("%i", clientCount));
info.set("bots", Utils::String::VA("%i", botCount));
info.set("sv_maxclients", Utils::String::VA("%i", maxclientCount));
info.set("protocol", Utils::String::VA("%i", PROTOCOL));
info.set("shortversion", SHORTVERSION);

View File

@ -103,7 +103,7 @@ namespace Components
case Column::Players:
{
return Utils::String::VA("%i (%i)", server->clients, server->maxClients);
return Utils::String::VA("%i/%i (%i)", server->clients, server->maxClients, server->bots);
}
case Column::Gametype:
@ -460,6 +460,7 @@ namespace Components
server.mod = info.get("fs_game");
server.matchType = atoi(info.get("matchtype").data());
server.clients = atoi(info.get("clients").data());
server.bots = atoi(info.get("bots").data());
server.securityLevel = atoi(info.get("securityLevel").data());
server.maxClients = atoi(info.get("sv_maxclients").data());
server.password = (atoi(info.get("isPrivate").data()) != 0);

View File

@ -20,6 +20,7 @@ namespace Components
std::string mod;
std::string shortversion;
int clients;
int bots;
int maxClients;
bool password;
int ping;