try to resolve rjlan's forgetting-configs issue.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4568 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2013-12-19 16:36:17 +00:00
parent f762446a7d
commit 4a19ae4627
2 changed files with 10 additions and 4 deletions

View file

@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
cvar_t cfg_reload_on_gamedir = CVAR("cfg_reload_on_gamedir", "1");
cvar_t com_fs_cache = SCVARF("fs_cache", IFMINIMAL("2","1"), CVAR_ARCHIVE);
cvar_t rcon_level = SCVAR("rcon_level", "20");
cvar_t cmd_maxbuffersize = SCVAR("cmd_maxbuffersize", "65536");
@ -3062,6 +3063,7 @@ void Cmd_Init (void)
Cmd_AddCommand ("cfg_load",Cmd_Exec_f);
Cmd_AddCommand ("cfg_reset",Cmd_Reset_f);
Cvar_Register(&cfg_reload_on_gamedir, "Filesystem");
Cmd_AddCommand ("exec",Cmd_Exec_f);
Cmd_AddCommand ("echo",Cmd_Echo_f);

View file

@ -21,6 +21,7 @@ qboolean blockcache = true;
qboolean com_fschanged = true;
static unsigned int fs_restarts;
extern cvar_t com_fs_cache;
extern cvar_t cfg_reload_on_gamedir;
int active_fs_cachetype;
static int fs_referencetype;
int fs_finds;
@ -2007,7 +2008,7 @@ void COM_Gamedir (const char *dir)
}
Z_Free(dup);
}
FS_ChangeGame(man, true);
FS_ChangeGame(man, cfg_reload_on_gamedir.ival);
#if 0
char thispath[64];
@ -3362,11 +3363,11 @@ qboolean FS_ChangeGame(ftemanifest_t *man, qboolean allowreloadconfigs)
//if any of these files change location, the configs will be re-execed.
//note that we reuse path handles if they're still valid, so we can just check the pointer to see if it got unloaded/replaced.
char *conffile[] = {"quake.rc", "hexen.rc", "default.cfg", "server.cfg", NULL};
searchpath_t *confpath[sizeof(conffile)/sizeof(conffile[0])];
searchpathfuncs_t *confpath[sizeof(conffile)/sizeof(conffile[0])];
for (i = 0; conffile[i]; i++)
{
FS_FLocateFile(conffile[i], FSLFRT_IFFOUND, &loc); //q1
confpath[i] = loc.search;
confpath[i] = loc.search?loc.search->handle:NULL;
}
i = COM_CheckParm ("-basedir");
@ -3477,8 +3478,11 @@ qboolean FS_ChangeGame(ftemanifest_t *man, qboolean allowreloadconfigs)
for (i = 0; conffile[i]; i++)
{
FS_FLocateFile(conffile[i], FSLFRT_IFFOUND, &loc);
if (confpath[i] != loc.search)
if (confpath[i] != (loc.search?loc.search->handle:NULL))
{
reloadconfigs = true;
Con_DPrintf("Reloading configs because %s has changed\n", conffile[i]);
}
}
if (reloadconfigs)