From d096a47f48f704ead9278c756a13da1f4a46f6f9 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Mon, 12 Jun 2017 21:01:56 +0200 Subject: [PATCH] [ServerList] Display bots separately --- src/Components/Modules/Party.cpp | 5 ++++- src/Components/Modules/ServerList.cpp | 3 ++- src/Components/Modules/ServerList.hpp | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Components/Modules/Party.cpp b/src/Components/Modules/Party.cpp index aac18715..43614c6c 100644 --- a/src/Components/Modules/Party.cpp +++ b/src/Components/Modules/Party.cpp @@ -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()); 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); diff --git a/src/Components/Modules/ServerList.cpp b/src/Components/Modules/ServerList.cpp index eb860820..1684764d 100644 --- a/src/Components/Modules/ServerList.cpp +++ b/src/Components/Modules/ServerList.cpp @@ -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); diff --git a/src/Components/Modules/ServerList.hpp b/src/Components/Modules/ServerList.hpp index f333a7f2..4b246ce8 100644 --- a/src/Components/Modules/ServerList.hpp +++ b/src/Components/Modules/ServerList.hpp @@ -20,6 +20,7 @@ namespace Components std::string mod; std::string shortversion; int clients; + int bots; int maxClients; bool password; int ping;