[quake3-commits] r2053 - in trunk/code: client qcommon
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Jun 22 19:00:36 EDT 2011
Author: thilo
Date: 2011-06-22 19:00:36 -0400 (Wed, 22 Jun 2011)
New Revision: 2053
Modified:
trunk/code/client/cl_main.c
trunk/code/qcommon/common.c
trunk/code/qcommon/cvar.c
trunk/code/qcommon/files.c
trunk/code/qcommon/qcommon.h
Log:
- Automatically reset fs_game to "" if it was supplied by the user and is equal to com_basegame
- Fix problem where users could change values of CVAR_INIT variables after the call to Cvar_Get() via Com_StartupVariable()
- Move sound shutdown after client shutdown so VMs don't hold invalid sound handles in memory
Modified: trunk/code/client/cl_main.c
===================================================================
--- trunk/code/client/cl_main.c 2011-06-22 14:36:11 UTC (rev 2052)
+++ trunk/code/client/cl_main.c 2011-06-22 23:00:36 UTC (rev 2053)
@@ -3392,8 +3392,8 @@
if(disconnect)
CL_Disconnect(qtrue);
+ CL_ClearMemory(qtrue);
CL_Snd_Shutdown();
- CL_ClearMemory(qtrue);
Cmd_RemoveCommand ("cmd");
Cmd_RemoveCommand ("configstrings");
Modified: trunk/code/qcommon/common.c
===================================================================
--- trunk/code/qcommon/common.c 2011-06-22 14:36:11 UTC (rev 2052)
+++ trunk/code/qcommon/common.c 2011-06-22 23:00:36 UTC (rev 2053)
@@ -475,7 +475,7 @@
if(Cvar_Flags(s) == CVAR_NONEXISTENT)
Cvar_Get(s, Cmd_Argv(2), CVAR_USER_CREATED);
else
- Cvar_Set(s, Cmd_Argv(2));
+ Cvar_Set2(s, Cmd_Argv(2), qfalse);
}
}
}
@@ -2391,9 +2391,10 @@
// make sure no recursion can be triggered
if(!com_gameRestarting && com_fullyInitialized)
{
- int clWasRunning = com_cl_running->integer;
+ int clWasRunning;
com_gameRestarting = qtrue;
+ clWasRunning = com_cl_running->integer;
// Kill server if we have one
if(com_sv_running->integer)
@@ -2441,7 +2442,16 @@
void Com_GameRestart_f(void)
{
- Cvar_Set("fs_game", Cmd_Argv(1));
+ if(!FS_FilenameCompare(Cmd_Argv(1), com_basegame->string))
+ {
+ // This is the standard base game. Servers and clients should
+ // use "" and not the standard basegame name because this messes
+ // up pak file negotiation and lots of other stuff
+
+ Cvar_Set("fs_game", "");
+ }
+ else
+ Cvar_Set("fs_game", Cmd_Argv(1));
Com_GameRestart(0, qtrue);
}
@@ -2703,7 +2713,6 @@
if(!com_basegame->string[0])
Cvar_ForceReset("com_basegame");
- // Com_StartupVariable(
FS_InitFilesystem ();
Com_InitJournaling();
Modified: trunk/code/qcommon/cvar.c
===================================================================
--- trunk/code/qcommon/cvar.c 2011-06-22 14:36:11 UTC (rev 2052)
+++ trunk/code/qcommon/cvar.c 2011-06-22 23:00:36 UTC (rev 2053)
@@ -35,8 +35,6 @@
#define FILE_HASH_SIZE 256
static cvar_t *hashTable[FILE_HASH_SIZE];
-cvar_t *Cvar_Set2( const char *var_name, const char *value, qboolean force);
-
/*
================
return a hash value for the filename
Modified: trunk/code/qcommon/files.c
===================================================================
--- trunk/code/qcommon/files.c 2011-06-22 14:36:11 UTC (rev 2052)
+++ trunk/code/qcommon/files.c 2011-06-22 23:00:36 UTC (rev 2053)
@@ -3792,10 +3792,13 @@
// we have to specially handle this, because normal command
// line variable sets don't happen until after the filesystem
// has already been initialized
- Com_StartupVariable( "fs_basepath" );
- Com_StartupVariable( "fs_homepath" );
- Com_StartupVariable( "fs_game" );
+ Com_StartupVariable("fs_basepath");
+ Com_StartupVariable("fs_homepath");
+ Com_StartupVariable("fs_game");
+ if(!FS_FilenameCompare(Cvar_VariableString("fs_game"), com_basegame->string))
+ Cvar_Set("fs_game", "");
+
// try to start up normally
FS_Startup(com_basegame->string);
Modified: trunk/code/qcommon/qcommon.h
===================================================================
--- trunk/code/qcommon/qcommon.h 2011-06-22 14:36:11 UTC (rev 2052)
+++ trunk/code/qcommon/qcommon.h 2011-06-22 23:00:36 UTC (rev 2053)
@@ -504,6 +504,9 @@
void Cvar_Set( const char *var_name, const char *value );
// will create the variable with no flags if it doesn't exist
+cvar_t *Cvar_Set2(const char *var_name, const char *value, qboolean force);
+// same as Cvar_Set, but allows more control over setting of cvar
+
void Cvar_SetSafe( const char *var_name, const char *value );
// sometimes we set variables from an untrusted source: fail if flags & CVAR_PROTECTED
More information about the quake3-commits
mailing list