diff --git a/code/qcommon/files.c b/code/qcommon/files.c index 5c5e3641..c2202657 100644 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -3025,10 +3025,7 @@ static void FS_CheckPak0( void ) } } - if(com_basegame->string[0] && - Q_stricmp(com_basegame->string, BASEGAME) && - !foundPak && !foundTA - ) + if(!foundPak && !foundTA && Q_stricmp(com_basegame->string, BASEGAME)) { Cvar_Set("com_standalone", "1"); } @@ -3660,3 +3657,11 @@ void FS_FilenameCompletion( const char *dir, const char *ext, } FS_FreeFileList( filenames ); } + +const char *FS_GetCurrentGameDir(void) +{ + if(fs_gamedirvar->string[0]) + return fs_gamedirvar->string; + + return com_basegame->string; +} diff --git a/code/qcommon/qcommon.h b/code/qcommon/qcommon.h index 2ee952c0..3a04ba94 100644 --- a/code/qcommon/qcommon.h +++ b/code/qcommon/qcommon.h @@ -714,6 +714,8 @@ void FS_HomeRemove( const char *homePath ); void FS_FilenameCompletion( const char *dir, const char *ext, qboolean stripExt, void(*callback)(const char *s) ); +const char *FS_GetCurrentGameDir(void); + /* ============================================================== diff --git a/code/server/sv_ccmds.c b/code/server/sv_ccmds.c index 4f0b4cb0..508faea9 100644 --- a/code/server/sv_ccmds.c +++ b/code/server/sv_ccmds.c @@ -549,10 +549,7 @@ static void SV_RehashBans_f(void) if(!sv_banFile->string || !*sv_banFile->string) return; - if(!(curpos = Cvar_VariableString("fs_game")) || !*curpos) - curpos = BASEGAME; - - Com_sprintf(filepath, sizeof(filepath), "%s/%s", curpos, sv_banFile->string); + Com_sprintf(filepath, sizeof(filepath), "%s/%s", FS_GetCurrentGameDir(), sv_banFile->string); if((filelen = FS_SV_FOpenFileRead(filepath, &readfrom)) >= 0) { @@ -626,15 +623,12 @@ static void SV_WriteBans(void) { int index; fileHandle_t writeto; - char *curpos, filepath[MAX_QPATH]; + char filepath[MAX_QPATH]; if(!sv_banFile->string || !*sv_banFile->string) return; - if(!(curpos = Cvar_VariableString("fs_game")) || !*curpos) - curpos = BASEGAME; - - Com_sprintf(filepath, sizeof(filepath), "%s/%s", curpos, sv_banFile->string); + Com_sprintf(filepath, sizeof(filepath), "%s/%s", FS_GetCurrentGameDir(), sv_banFile->string); if((writeto = FS_SV_FOpenFileWrite(filepath))) {