From 00bf016576f62bc31fac767ba6aeed71d54d893a Mon Sep 17 00:00:00 2001 From: Yamagi Burmeister Date: Sat, 16 Dec 2017 16:42:24 +0100 Subject: [PATCH] Rewrite all cvars, not just the ones loaded from config.cfg. And print a nice message thate the cvar is deprecated. --- src/common/cmdparser.c | 9 --------- src/common/cvar.c | 14 +++++++------- src/common/header/common.h | 3 --- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/common/cmdparser.c b/src/common/cmdparser.c index a316f611..4f9cafcf 100644 --- a/src/common/cmdparser.c +++ b/src/common/cmdparser.c @@ -924,9 +924,6 @@ Cmd_IsComplete(char *command) /* ugly hack to suppress warnings from default.cfg in Key_Bind_f() */ 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 */ @@ -950,12 +947,6 @@ Cmd_ExecuteString(char *text) 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 */ for (cmd = cmd_functions; cmd; cmd = cmd->next) { diff --git a/src/common/cvar.c b/src/common/cvar.c index c0e5f534..3e65dc1d 100644 --- a/src/common/cvar.c +++ b/src/common/cvar.c @@ -433,17 +433,17 @@ Cvar_Set_f(void) firstarg = Cmd_Argv(1); - /* An ugly hack to rewrite CVARs loaded from config.cfg */ - if (!doneWithCfg) + /* An ugly hack to rewrite changed CVARs */ + 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)) - { - firstarg = replacements[i].new; - } + Com_Printf("cvar %s ist deprecated, use %s instead\n", replacements[i].old, replacements[i].new); + + firstarg = replacements[i].new; } } + if (c == 4) { if (!strcmp(Cmd_Argv(3), "u")) diff --git a/src/common/header/common.h b/src/common/header/common.h index 8541bb80..e4645abe 100644 --- a/src/common/header/common.h +++ b/src/common/header/common.h @@ -313,9 +313,6 @@ enum clc_ops_e #define EXEC_INSERT 1 /* insert at current position, but don't run yet */ #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); /* allocates an initial text buffer that will grow as needed */