[quake3-commits] r2149 - in trunk/code: client qcommon

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Aug 24 10:47:57 EDT 2011


Author: thilo
Date: 2011-08-24 10:47:57 -0400 (Wed, 24 Aug 2011)
New Revision: 2149

Modified:
   trunk/code/client/cl_parse.c
   trunk/code/qcommon/cvar.c
   trunk/code/qcommon/files.c
   trunk/code/qcommon/q_shared.h
Log:
Fix auto game-restart when disconnecting from a server that explicitly set fs_game to "baseq3" instead of ""


Modified: trunk/code/client/cl_parse.c
===================================================================
--- trunk/code/client/cl_parse.c	2011-08-22 20:30:45 UTC (rev 2148)
+++ trunk/code/client/cl_parse.c	2011-08-24 14:47:57 UTC (rev 2149)
@@ -538,12 +538,14 @@
 		CL_StopRecord_f();
 	
 	// reinitialize the filesystem if the game directory has changed
-	if(FS_ConditionalRestart(clc.checksumFeed, qfalse) && !cls.oldGameSet)
+	if(!cls.oldGameSet && (Cvar_Flags("fs_game") & CVAR_MODIFIED))
 	{
 		cls.oldGameSet = qtrue;
 		Q_strncpyz(cls.oldGame, oldGame, sizeof(cls.oldGame));
 	}
 
+	FS_ConditionalRestart(clc.checksumFeed, qfalse);
+
 	// This used to call CL_StartHunkUsers, but now we enter the download state before loading the
 	// cgame
 	CL_InitDownloads();

Modified: trunk/code/qcommon/cvar.c
===================================================================
--- trunk/code/qcommon/cvar.c	2011-08-22 20:30:45 UTC (rev 2148)
+++ trunk/code/qcommon/cvar.c	2011-08-24 14:47:57 UTC (rev 2149)
@@ -168,10 +168,15 @@
 {
 	cvar_t *var;
 	
-	if(! (var = Cvar_FindVar(var_name)) )
+	if(!(var = Cvar_FindVar(var_name)))
 		return CVAR_NONEXISTENT;
 	else
-		return var->flags;
+	{
+		if(var->modified)
+			return var->flags | CVAR_MODIFIED;
+		else
+			return var->flags;
+	}
 }
 
 /*

Modified: trunk/code/qcommon/files.c
===================================================================
--- trunk/code/qcommon/files.c	2011-08-22 20:30:45 UTC (rev 2148)
+++ trunk/code/qcommon/files.c	2011-08-24 14:47:57 UTC (rev 2149)
@@ -3879,13 +3879,13 @@
 /*
 =================
 FS_ConditionalRestart
-restart if necessary
+
+Restart if necessary
+Return qtrue if restarting due to game directory changed, qfalse otherwise
 =================
 */
 qboolean FS_ConditionalRestart(int checksumFeed, qboolean disconnect)
 {
-	int retval;
-	
 	if(fs_gamedirvar->modified)
 	{
 		if(FS_FilenameCompare(lastValidGame, fs_gamedirvar->string) &&
@@ -3896,13 +3896,8 @@
 			return qtrue;
 		}
 		else
-		{
 			fs_gamedirvar->modified = qfalse;
-			retval = qtrue;
-		}
 	}
-	else
-		retval = qfalse;
 	
 	if(checksumFeed != fs_checksumFeed)
 		FS_Restart(checksumFeed);

Modified: trunk/code/qcommon/q_shared.h
===================================================================
--- trunk/code/qcommon/q_shared.h	2011-08-22 20:30:45 UTC (rev 2148)
+++ trunk/code/qcommon/q_shared.h	2011-08-24 14:47:57 UTC (rev 2149)
@@ -888,7 +888,9 @@
 #define CVAR_SERVER_CREATED	0x0800	// cvar was created by a server the client connected to.
 #define CVAR_VM_CREATED		0x1000	// cvar was created exclusively in one of the VMs.
 #define CVAR_PROTECTED		0x2000	// prevent modifying this var from VMs or the server
-#define CVAR_NONEXISTENT	0xFFFFFFFF	// Cvar doesn't exist.
+// These flags are only returned by the Cvar_Flags() function
+#define CVAR_MODIFIED		0x40000000	// Cvar was modified
+#define CVAR_NONEXISTENT	0x80000000	// Cvar doesn't exist.
 
 // nothing outside the Cvar_*() functions should modify these fields!
 typedef struct cvar_s cvar_t;



More information about the quake3-commits mailing list