Don't register fs_game cvar everywhere just to get the value

This commit is contained in:
Zack Middleton 2018-01-21 02:38:08 -06:00
parent 3a6af1bc48
commit adef4e6c9e
4 changed files with 17 additions and 26 deletions

View file

@ -2943,9 +2943,6 @@ Writes key bindings and archived cvars to config file if modified
===============
*/
void Com_WriteConfiguration( void ) {
#if !defined(DEDICATED) && !defined(STANDALONE)
cvar_t *fs;
#endif
// if we are quiting without fully initializing, make sure
// we don't write out anything
if ( !com_fullyInitialized ) {
@ -2961,12 +2958,12 @@ void Com_WriteConfiguration( void ) {
// not needed for dedicated or standalone
#if !defined(DEDICATED) && !defined(STANDALONE)
fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
if(!com_standalone->integer)
{
if (UI_usesUniqueCDKey() && fs && fs->string[0] != 0) {
Com_WriteCDKey( fs->string, &cl_cdkey[16] );
const char *gamedir;
gamedir = Cvar_VariableString( "fs_game" );
if (UI_usesUniqueCDKey() && gamedir[0] != 0) {
Com_WriteCDKey( gamedir, &cl_cdkey[16] );
} else {
Com_WriteCDKey( BASEGAME, cl_cdkey );
}

View file

@ -3369,14 +3369,10 @@ static void FS_Startup( const char *gameName )
}
#ifndef STANDALONE
if(!com_standalone->integer)
{
cvar_t *fs;
if (!com_standalone->integer) {
Com_ReadCDKey(BASEGAME);
fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
if (fs && fs->string[0] != 0) {
Com_AppendCDKey( fs->string );
if (fs_gamedirvar->string[0]) {
Com_AppendCDKey(fs_gamedirvar->string);
}
}
#endif