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.
This commit is contained in:
Yamagi Burmeister 2016-12-13 17:03:11 +01:00
parent 68a12d4ee1
commit 2b317075c7
6 changed files with 2 additions and 33 deletions

View file

@ -987,8 +987,6 @@ CL_Init(void)
CL_InitLocal();
FS_ExecAutoexec();
Cbuf_Execute();
Key_ReadConsoleHistory();

View file

@ -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();
}
}
}

View file

@ -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.
*/

View file

@ -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 */

View file

@ -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();

View file

@ -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(