Fix auto game-restart when disconnecting from a server that explicitly set fs_game to "baseq3" instead of ""

This commit is contained in:
Thilo Schulz 2011-08-24 14:47:57 +00:00
parent abe85940ae
commit de182882f1
4 changed files with 16 additions and 12 deletions

View file

@ -538,12 +538,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();

View file

@ -168,10 +168,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
{
if(var->modified)
return var->flags | CVAR_MODIFIED;
else
return var->flags;
}
}
/*

View file

@ -3879,13 +3879,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) &&
@ -3896,13 +3896,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);

View file

@ -888,7 +888,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;