Rewrite all cvars, not just the ones loaded from config.cfg.

And print a nice message thate the cvar is deprecated.
This commit is contained in:
Yamagi Burmeister 2017-12-16 16:42:24 +01:00
parent b433ee10fd
commit 00bf016576
3 changed files with 7 additions and 19 deletions

View File

@ -924,9 +924,6 @@ Cmd_IsComplete(char *command)
/* ugly hack to suppress warnings from default.cfg in Key_Bind_f() */ /* ugly hack to suppress warnings from default.cfg in Key_Bind_f() */
qboolean doneWithDefaultCfg; qboolean doneWithDefaultCfg;
/* Another ugly hack, this time to rewrite CVARs loaded from config.cfg */
qboolean doneWithCfg;
/* /*
* A complete command line has been parsed, so try to execute it * A complete command line has been parsed, so try to execute it
*/ */
@ -950,12 +947,6 @@ Cmd_ExecuteString(char *text)
doneWithDefaultCfg = true; doneWithDefaultCfg = true;
} }
if(Cmd_Argc() > 1 && Q_strcasecmp(cmd_argv[0], "exec") == 0 && Q_strcasecmp(cmd_argv[1], "autoexec.cfg") == 0)
{
/* exec autoexec.cfg is done directly after exec config.cfg, see Qcommon_Init() */
doneWithCfg = true;
}
/* check functions */ /* check functions */
for (cmd = cmd_functions; cmd; cmd = cmd->next) for (cmd = cmd_functions; cmd; cmd = cmd->next)
{ {

View File

@ -433,17 +433,17 @@ Cvar_Set_f(void)
firstarg = Cmd_Argv(1); firstarg = Cmd_Argv(1);
/* An ugly hack to rewrite CVARs loaded from config.cfg */ /* An ugly hack to rewrite changed CVARs */
if (!doneWithCfg) for (i = 0; i < sizeof(replacements) / sizeof(replacement_t); i++)
{ {
for (i = 0; i < sizeof(replacements) / sizeof(replacement_t); i++) if (!strcmp(firstarg, replacements[i].old))
{ {
if (!strcmp(firstarg, replacements[i].old)) Com_Printf("cvar %s ist deprecated, use %s instead\n", replacements[i].old, replacements[i].new);
{
firstarg = replacements[i].new; firstarg = replacements[i].new;
}
} }
} }
if (c == 4) if (c == 4)
{ {
if (!strcmp(Cmd_Argv(3), "u")) if (!strcmp(Cmd_Argv(3), "u"))

View File

@ -313,9 +313,6 @@ enum clc_ops_e
#define EXEC_INSERT 1 /* insert at current position, but don't run yet */ #define EXEC_INSERT 1 /* insert at current position, but don't run yet */
#define EXEC_APPEND 2 /* add to end of the command buffer */ #define EXEC_APPEND 2 /* add to end of the command buffer */
/* An ugly hack to rewrite CVARs loaded from config.cfg */
extern qboolean doneWithCfg;
void Cbuf_Init(void); void Cbuf_Init(void);
/* allocates an initial text buffer that will grow as needed */ /* allocates an initial text buffer that will grow as needed */