r1358 - in trunk/code: client server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Jun 2 15:52:17 EDT 2008


Author: icculus
Date: 2008-06-02 15:52:13 -0400 (Mon, 02 Jun 2008)
New Revision: 1358

Modified:
   trunk/code/client/cl_main.c
   trunk/code/client/cl_parse.c
   trunk/code/server/sv_client.c
Log:
More VoIP work: treat voip/sv_voip cvars as protocol version numbers.


Modified: trunk/code/client/cl_main.c
===================================================================
--- trunk/code/client/cl_main.c	2008-06-02 19:41:09 UTC (rev 1357)
+++ trunk/code/client/cl_main.c	2008-06-02 19:52:13 UTC (rev 1358)
@@ -3037,6 +3037,12 @@
 	cl_voipGainDuringCapture = Cvar_Get ("cl_voipGainDuringCapture", "0.2", CVAR_ARCHIVE);
 	voip = Cvar_Get ("voip", "0", CVAR_USERINFO | CVAR_ARCHIVE | CVAR_LATCH);
 
+	// This is a protocol version number.
+	if ( (voip->integer < 0) || (voip->integer > 1) ) {
+		Com_Printf("WARNING: voip cvar must be 0 or 1. Setting to 1.");
+		Cvar_Set ("voip", "1");
+	}
+
 	// If your data rate is too low, you'll get Connection Interrupted warnings
 	//  when VoIP packets arrive, even if you have a broadband connection.
 	//  This might work on rates lower than 25000, but for safety's sake, we'll

Modified: trunk/code/client/cl_parse.c
===================================================================
--- trunk/code/client/cl_parse.c	2008-06-02 19:41:09 UTC (rev 1357)
+++ trunk/code/client/cl_parse.c	2008-06-02 19:52:13 UTC (rev 1358)
@@ -365,8 +365,10 @@
 	}
 
 #if USE_VOIP
+	// in the future, (val) will be a protocol version string, so only
+	//  accept explicitly 1, not generally non-zero.
 	s = Info_ValueForKey( systemInfo, "sv_voip" );
-	cl_connectedToVoipServer = atoi( s );
+	cl_connectedToVoipServer = (atoi( s ) == 1);
 #endif
 
 	s = Info_ValueForKey( systemInfo, "sv_cheats" );

Modified: trunk/code/server/sv_client.c
===================================================================
--- trunk/code/server/sv_client.c	2008-06-02 19:41:09 UTC (rev 1357)
+++ trunk/code/server/sv_client.c	2008-06-02 19:52:13 UTC (rev 1358)
@@ -1371,8 +1371,10 @@
 	}
 	
 #if USE_VOIP
+	// in the future, (val) will be a protocol version string, so only
+	//  accept explicitly 1, not generally non-zero.
 	val = Info_ValueForKey (cl->userinfo, "voip");
-	cl->hasVoip = (strlen(val) && atoi(val)) ? qtrue : qfalse;
+	cl->hasVoip = (atoi(val) == 1) ? qtrue : qfalse;
 #endif
 
 	// TTimo




More information about the quake3-commits mailing list