]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added reporting of number of bots in getinfo/getstatus replies (they are
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 18 Apr 2007 07:51:11 +0000 (07:51 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 18 Apr 2007 07:51:11 +0000 (07:51 +0000)
counted as clients also, so something parsing the info can deduct them
if it wishes)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7124 d7cf8633-e32d-0410-b094-e92efae38249

netconn.c

index 833c50a5fb418ec556375f242e4b229fb0194820..0860c7ceb7d503fa881e08f74883a396059ac999 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -1731,24 +1731,30 @@ static void NetConn_BuildChallengeString(char *buffer, int bufferlength)
 
 static qboolean NetConn_BuildStatusResponse(const char* challenge, char* out_msg, size_t out_size, qboolean fullstatus)
 {
-       unsigned int nb_clients = 0, i;
+       unsigned int nb_clients = 0, nb_bots = 0, i;
        int length;
 
        // How many clients are there?
        for (i = 0;i < (unsigned int)svs.maxclients;i++)
+       {
                if (svs.clients[i].active)
+               {
                        nb_clients++;
+                       if (!svs.clients[i].netconnection)
+                               nb_bots++;
+               }
+       }
 
        // TODO: we should add more information for the full status string
        length = dpsnprintf(out_msg, out_size,
                                                "\377\377\377\377%s\x0A"
                                                "\\gamename\\%s\\modname\\%s\\gameversion\\%d\\sv_maxclients\\%d"
-                                               "\\clients\\%d\\mapname\\%s\\hostname\\%s\\protocol\\%d"
+                                               "\\clients\\%d\\bots\\%d\\mapname\\%s\\hostname\\%s\\protocol\\%d"
                                                "%s%s"
                                                "%s",
                                                fullstatus ? "statusResponse" : "infoResponse",
                                                gamename, com_modname, gameversion.integer, svs.maxclients,
-                                               nb_clients, sv.name, hostname.string, NET_PROTOCOL_VERSION,
+                                               nb_clients, nb_bots, sv.name, hostname.string, NET_PROTOCOL_VERSION,
                                                challenge ? "\\challenge\\" : "", challenge ? challenge : "",
                                                fullstatus ? "\n" : "");