[quake3-commits] r1908 - in trunk: . code/client code/qcommon code/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Mar 5 14:10:23 EST 2011


Author: thilo
Date: 2011-03-05 14:10:23 -0500 (Sat, 05 Mar 2011)
New Revision: 1908

Modified:
   trunk/README
   trunk/code/client/cl_main.c
   trunk/code/qcommon/common.c
   trunk/code/qcommon/qcommon.h
   trunk/code/server/sv_client.c
   trunk/code/server/sv_init.c
   trunk/code/server/sv_main.c
Log:
Add cvar "protocol" so user can change protocol version on command line, for standalone games. Most of the patch by Simon McVittie with a few minor modifications by myself


Modified: trunk/README
===================================================================
--- trunk/README	2011-03-05 19:07:56 UTC (rev 1907)
+++ trunk/README	2011-03-05 19:10:23 UTC (rev 1908)
@@ -113,6 +113,7 @@
   cl_mouseAccelOffset               - Tuning the acceleration curve, see below
   cl_gamename                       - Gamename sent to master server in
                                       getserversExt query
+
   s_useOpenAL                       - use the OpenAL sound backend if available
   s_alPrecache                      - cache OpenAL sounds before use
   s_alGain                          - the value of AL_GAIN for each source
@@ -155,6 +156,7 @@
   com_maxfpsMinimized               - Maximum frames per second when minimized
   com_busyWait                      - Will use a busy loop to wait for rendering
                                       next frame when set to non-zero value
+
   in_joystickNo                     - select which joystick to use
   in_keyboardDebug                  - print keyboard debug info
 
@@ -178,6 +180,9 @@
                                       ipv6 servers on the local network
   net_mcastiface                    - outgoing interface to use for scan
 
+  protocol                          - Allow changing protocol version
+                                      (startup only)
+
   r_allowResize                     - make window resizable (SDL only)
   r_ext_texture_filter_anisotropic  - anisotropic texture filtering
   r_zProj                           - distance of observer camera to projection

Modified: trunk/code/client/cl_main.c
===================================================================
--- trunk/code/client/cl_main.c	2011-03-05 19:07:56 UTC (rev 1907)
+++ trunk/code/client/cl_main.c	2011-03-05 19:10:23 UTC (rev 1908)
@@ -2124,7 +2124,7 @@
 		port = Cvar_VariableValue ("net_qport");
 
 		Q_strncpyz( info, Cvar_InfoString( CVAR_USERINFO ), sizeof( info ) );
-		Info_SetValueForKey( info, "protocol", va("%i", PROTOCOL_VERSION ) );
+		Info_SetValueForKey( info, "protocol", va("%i", com_protocol->integer ) );
 		Info_SetValueForKey( info, "qport", va("%i", port ) );
 		Info_SetValueForKey( info, "challenge", va("%i", clc.challenge ) );
 		
@@ -3405,7 +3405,7 @@
 
 	// if this isn't the correct protocol version, ignore it
 	prot = atoi( Info_ValueForKey( infoString, "protocol" ) );
-	if ( prot != PROTOCOL_VERSION ) {
+	if ( prot != com_protocol->integer ) {
 		Com_DPrintf( "Different protocol info packet: %s\n", infoString );
 		return;
 	}

Modified: trunk/code/qcommon/common.c
===================================================================
--- trunk/code/qcommon/common.c	2011-03-05 19:07:56 UTC (rev 1907)
+++ trunk/code/qcommon/common.c	2011-03-05 19:10:23 UTC (rev 1908)
@@ -83,6 +83,7 @@
 cvar_t	*com_maxfpsMinimized;
 cvar_t	*com_abnormalExit;
 cvar_t	*com_standalone;
+cvar_t	*com_protocol;
 cvar_t	*com_basegame;
 cvar_t  *com_homepath;
 cvar_t	*com_busyWait;
@@ -2705,6 +2706,7 @@
 
 	s = va("%s %s %s", Q3_VERSION, PLATFORM_STRING, __DATE__ );
 	com_version = Cvar_Get ("version", s, CVAR_ROM | CVAR_SERVERINFO );
+	com_protocol = Cvar_Get ("protocol", va("%i", PROTOCOL_VERSION), CVAR_SERVERINFO | CVAR_INIT);
 
 	Sys_Init();
 

Modified: trunk/code/qcommon/qcommon.h
===================================================================
--- trunk/code/qcommon/qcommon.h	2011-03-05 19:07:56 UTC (rev 1907)
+++ trunk/code/qcommon/qcommon.h	2011-03-05 19:10:23 UTC (rev 1908)
@@ -848,6 +848,8 @@
 extern	cvar_t	*cl_packetdelay;
 extern	cvar_t	*sv_packetdelay;
 
+extern	cvar_t	*com_protocol;
+
 // com_speeds times
 extern	int		time_game;
 extern	int		time_frontend;

Modified: trunk/code/server/sv_client.c
===================================================================
--- trunk/code/server/sv_client.c	2011-03-05 19:07:56 UTC (rev 1907)
+++ trunk/code/server/sv_client.c	2011-03-05 19:10:23 UTC (rev 1908)
@@ -302,8 +302,8 @@
 	Q_strncpyz( userinfo, Cmd_Argv(1), sizeof(userinfo) );
 
 	version = atoi( Info_ValueForKey( userinfo, "protocol" ) );
-	if ( version != PROTOCOL_VERSION ) {
-		NET_OutOfBandPrint( NS_SERVER, from, "print\nServer uses protocol version %i.\n", PROTOCOL_VERSION );
+	if ( version != com_protocol->integer ) {
+		NET_OutOfBandPrint( NS_SERVER, from, "print\nServer uses protocol version %i (yours is %i).\n", com_protocol->integer, version );
 		Com_DPrintf ("    rejected connect from version %i\n", version);
 		return;
 	}

Modified: trunk/code/server/sv_init.c
===================================================================
--- trunk/code/server/sv_init.c	2011-03-05 19:07:56 UTC (rev 1907)
+++ trunk/code/server/sv_init.c	2011-03-05 19:10:23 UTC (rev 1908)
@@ -636,7 +636,6 @@
 	Cvar_Get ("timelimit", "0", CVAR_SERVERINFO);
 	sv_gametype = Cvar_Get ("g_gametype", "0", CVAR_SERVERINFO | CVAR_LATCH );
 	Cvar_Get ("sv_keywords", "", CVAR_SERVERINFO);
-	Cvar_Get ("protocol", va("%i", PROTOCOL_VERSION), CVAR_SERVERINFO | CVAR_ROM);
 	sv_mapname = Cvar_Get ("mapname", "nomap", CVAR_SERVERINFO | CVAR_ROM);
 	sv_privateClients = Cvar_Get ("sv_privateClients", "0", CVAR_SERVERINFO);
 	sv_hostname = Cvar_Get ("sv_hostname", "noname", CVAR_SERVERINFO | CVAR_ARCHIVE );

Modified: trunk/code/server/sv_main.c
===================================================================
--- trunk/code/server/sv_main.c	2011-03-05 19:07:56 UTC (rev 1907)
+++ trunk/code/server/sv_main.c	2011-03-05 19:10:23 UTC (rev 1908)
@@ -638,7 +638,7 @@
 	// to prevent timed spoofed reply packets that add ghost servers
 	Info_SetValueForKey( infostring, "challenge", Cmd_Argv(1) );
 
-	Info_SetValueForKey( infostring, "protocol", va("%i", PROTOCOL_VERSION) );
+	Info_SetValueForKey( infostring, "protocol", va("%i", com_protocol->integer) );
 	Info_SetValueForKey( infostring, "hostname", sv_hostname->string );
 	Info_SetValueForKey( infostring, "mapname", sv_mapname->string );
 	Info_SetValueForKey( infostring, "clients", va("%i", count) );



More information about the quake3-commits mailing list