From 2b317075c7fc1e853a23aa4a4112976595ead324 Mon Sep 17 00:00:00 2001 From: Yamagi Burmeister Date: Tue, 13 Dec 2016 17:03:11 +0100 Subject: [PATCH] Treat autoexec.cfg like every other config. Until now autoexec.cfg was a special case. It was read several times, whenever the 'game' cvar was altered or when the client was restarted. But only if it was in the right directory in the right position of the internal search path... Remove this altogether and replace it by an ordinary 'exec autoexec.cfg' at startup. This may break some mods that depend on an autoexec.cfg if the user has his own version in ~/.yq2/. Such mods should use default.cfg instead. This closes issue #163. --- src/client/cl_main.c | 2 -- src/common/cvar.c | 2 -- src/common/filesystem.c | 27 --------------------------- src/common/header/common.h | 1 - src/common/misc.c | 1 + src/game/player/view.c | 2 +- 6 files changed, 2 insertions(+), 33 deletions(-) diff --git a/src/client/cl_main.c b/src/client/cl_main.c index 3c3566ba..49b415ef 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -987,8 +987,6 @@ CL_Init(void) CL_InitLocal(); - FS_ExecAutoexec(); - Cbuf_Execute(); Key_ReadConsoleHistory(); diff --git a/src/common/cvar.c b/src/common/cvar.c index ceaec0e0..7aa08ef4 100644 --- a/src/common/cvar.c +++ b/src/common/cvar.c @@ -253,7 +253,6 @@ Cvar_Set2(char *var_name, char *value, qboolean force) if (!strcmp(var->name, "game")) { FS_SetGamedir(var->string); - FS_ExecAutoexec(); } } @@ -372,7 +371,6 @@ Cvar_GetLatchedVars(void) if (!strcmp(var->name, "game")) { FS_SetGamedir(var->string); - FS_ExecAutoexec(); } } } diff --git a/src/common/filesystem.c b/src/common/filesystem.c index 0293ff2d..ae4ac936 100644 --- a/src/common/filesystem.c +++ b/src/common/filesystem.c @@ -1068,33 +1068,6 @@ FS_Path_f(void) #endif } -void -FS_ExecAutoexec(void) -{ - char *dir; - char name[MAX_QPATH]; - - dir = (char *)Cvar_VariableString("gamedir"); - - if (dir[0] != '\0') - { - Com_sprintf(name, sizeof(name), "%s/%s/autoexec.cfg", - fs_basedir->string, dir); - } - else - { - Com_sprintf(name, sizeof(name), "%s/%s/autoexec.cfg", - fs_basedir->string, BASEDIRNAME); - } - - if (Sys_FindFirst(name, 0, SFF_SUBDIR | SFF_HIDDEN | SFF_SYSTEM) != NULL) - { - Cbuf_AddText("exec autoexec.cfg\n"); - } - - Sys_FindClose(); -} - /* * Sets the gamedir and path to a different directory. */ diff --git a/src/common/header/common.h b/src/common/header/common.h index 3dbb1039..7d19652c 100644 --- a/src/common/header/common.h +++ b/src/common/header/common.h @@ -684,7 +684,6 @@ void FS_InitFilesystem(void); void FS_SetGamedir(char *dir); char *FS_Gamedir(void); char *FS_NextPath(char *prevpath); -void FS_ExecAutoexec(void); int FS_LoadFile(char *path, void **buffer); /* a null buffer will just return the file length without loading */ diff --git a/src/common/misc.c b/src/common/misc.c index b474c721..73d56ee8 100644 --- a/src/common/misc.c +++ b/src/common/misc.c @@ -216,6 +216,7 @@ Qcommon_Init(int argc, char **argv) Cbuf_AddText("exec default.cfg\n"); Cbuf_AddText("exec yq2.cfg\n"); Cbuf_AddText("exec config.cfg\n"); + Cbuf_AddText("exec autoexec.cfg\n"); Cbuf_AddEarlyCommands(true); Cbuf_Execute(); diff --git a/src/game/player/view.c b/src/game/player/view.c index 61f398e7..4b2e52ab 100644 --- a/src/game/player/view.c +++ b/src/game/player/view.c @@ -799,7 +799,7 @@ P_WorldEffects(void) current_player->flags &= ~FL_INWATER; } - /* check for head just going under water */ + /* check for head just going under moove^^water */ if ((old_waterlevel != 3) && (waterlevel == 3)) { gi.sound(current_player, CHAN_BODY, gi.soundindex(