[quake3-commits] r1914 - in trunk/code: client server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Mar 7 18:12:16 EST 2011


Author: thilo
Date: 2011-03-07 18:12:16 -0500 (Mon, 07 Mar 2011)
New Revision: 1914

Modified:
   trunk/code/client/cl_main.c
   trunk/code/client/cl_ui.c
   trunk/code/client/client.h
   trunk/code/server/sv_main.c
Log:
Add g_humansplayers (found by server) and g_needpass (cvar) to serverinfo (#4702)


Modified: trunk/code/client/cl_main.c
===================================================================
--- trunk/code/client/cl_main.c	2011-03-07 23:07:24 UTC (rev 1913)
+++ trunk/code/client/cl_main.c	2011-03-07 23:12:16 UTC (rev 1914)
@@ -3382,6 +3382,8 @@
 			server->minPing = atoi(Info_ValueForKey(info, "minping"));
 			server->maxPing = atoi(Info_ValueForKey(info, "maxping"));
 			server->punkbuster = atoi(Info_ValueForKey(info, "punkbuster"));
+			server->g_humanplayers = atoi(Info_ValueForKey(info, "g_humanplayers"));
+			server->g_needpass = atoi(Info_ValueForKey(info, "g_needpass"));
 		}
 		server->ping = ping;
 	}
@@ -3500,6 +3502,8 @@
 	cls.localServers[i].gameType = 0;
 	cls.localServers[i].netType = from.type;
 	cls.localServers[i].punkbuster = 0;
+	cls.localServers[i].g_humanplayers = 0;
+	cls.localServers[i].g_needpass = 0;
 									 
 	Q_strncpyz( info, MSG_ReadString( msg ), MAX_INFO_STRING );
 	if (strlen(info)) {

Modified: trunk/code/client/cl_ui.c
===================================================================
--- trunk/code/client/cl_ui.c	2011-03-07 23:07:24 UTC (rev 1913)
+++ trunk/code/client/cl_ui.c	2011-03-07 23:12:16 UTC (rev 1914)
@@ -298,6 +298,8 @@
 		Info_SetValueForKey( info, "nettype", va("%i",server->netType));
 		Info_SetValueForKey( info, "addr", NET_AdrToStringwPort(server->adr));
 		Info_SetValueForKey( info, "punkbuster", va("%i", server->punkbuster));
+		Info_SetValueForKey( info, "g_needpass", va("%i", server->g_needpass));
+		Info_SetValueForKey( info, "g_humanplayers", va("%i", server->g_humanplayers));
 		Q_strncpyz(buf, info, buflen);
 	} else {
 		if (buf) {

Modified: trunk/code/client/client.h
===================================================================
--- trunk/code/client/client.h	2011-03-07 23:07:24 UTC (rev 1913)
+++ trunk/code/client/client.h	2011-03-07 23:12:16 UTC (rev 1914)
@@ -296,6 +296,8 @@
 	int			ping;
 	qboolean	visible;
 	int			punkbuster;
+	int			g_humanplayers;
+	int			g_needpass;
 } serverInfo_t;
 
 typedef struct {

Modified: trunk/code/server/sv_main.c
===================================================================
--- trunk/code/server/sv_main.c	2011-03-07 23:07:24 UTC (rev 1913)
+++ trunk/code/server/sv_main.c	2011-03-07 23:12:16 UTC (rev 1914)
@@ -606,7 +606,7 @@
 ================
 */
 void SVC_Info( netadr_t from ) {
-	int		i, count;
+	int		i, count, humans;
 	char	*gamedir;
 	char	infostring[MAX_INFO_STRING];
 
@@ -625,10 +625,13 @@
 		return;
 
 	// don't count privateclients
-	count = 0;
+	count = humans = 0;
 	for ( i = sv_privateClients->integer ; i < sv_maxclients->integer ; i++ ) {
 		if ( svs.clients[i].state >= CS_CONNECTED ) {
 			count++;
+			if (svs.clients[i].netchan.remoteAddress.type != NA_BOT) {
+				humans++;
+			}
 		}
 	}
 
@@ -642,10 +645,12 @@
 	Info_SetValueForKey( infostring, "hostname", sv_hostname->string );
 	Info_SetValueForKey( infostring, "mapname", sv_mapname->string );
 	Info_SetValueForKey( infostring, "clients", va("%i", count) );
+	Info_SetValueForKey( infostring, "g_humanplayers", va("%i", humans ) );
 	Info_SetValueForKey( infostring, "sv_maxclients", 
 		va("%i", sv_maxclients->integer - sv_privateClients->integer ) );
 	Info_SetValueForKey( infostring, "gametype", va("%i", sv_gametype->integer ) );
 	Info_SetValueForKey( infostring, "pure", va("%i", sv_pure->integer ) );
+	Info_SetValueForKey( infostring, "g_needpass", Cvar_VariableIntegerValue( "g_needpass" ));
 
 #ifdef USE_VOIP
 	if (sv_voip->integer) {



More information about the quake3-commits mailing list