summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/cl_parse.c4
-rw-r--r--src/qcommon/cvar.c9
-rw-r--r--src/qcommon/files.c11
-rw-r--r--src/qcommon/q_shared.h4
4 files changed, 16 insertions, 12 deletions
diff --git a/src/client/cl_parse.c b/src/client/cl_parse.c
index e8bb6011..38d9edd3 100644
--- a/src/client/cl_parse.c
+++ b/src/client/cl_parse.c
@@ -529,12 +529,14 @@ void CL_ParseGamestate( msg_t *msg ) {
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();
diff --git a/src/qcommon/cvar.c b/src/qcommon/cvar.c
index 0954e1f6..f71bc74f 100644
--- a/src/qcommon/cvar.c
+++ b/src/qcommon/cvar.c
@@ -169,10 +169,15 @@ int Cvar_Flags(const char *var_name)
{
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;
+ }
}
/*
diff --git a/src/qcommon/files.c b/src/qcommon/files.c
index 10e00f11..16499a0a 100644
--- a/src/qcommon/files.c
+++ b/src/qcommon/files.c
@@ -3586,13 +3586,13 @@ void FS_Restart( int checksumFeed ) {
/*
=================
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) &&
@@ -3603,13 +3603,8 @@ qboolean FS_ConditionalRestart(int checksumFeed, qboolean disconnect)
return qtrue;
}
else
- {
fs_gamedirvar->modified = qfalse;
- retval = qtrue;
- }
}
- else
- retval = qfalse;
if(checksumFeed != fs_checksumFeed)
FS_Restart(checksumFeed);
diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h
index 46a6e4b1..e007ae24 100644
--- a/src/qcommon/q_shared.h
+++ b/src/qcommon/q_shared.h
@@ -951,7 +951,9 @@ default values.
#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;