From 3ca282c3b46db64d78755e9e8384243068f71d17 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 15 Sep 2024 17:09:28 +0100 Subject: [PATCH] COM_Exec_f: By default, insert into command buffer - Resolves KartKrew/RingRacers#281 under standard operation - Add `-immediate` parameter for previous, `wait`-ignoring behaviour - Used by configfile, EXECCFG --- src/command.c | 15 +++++++++++++-- src/deh_soc.c | 2 +- src/m_misc.cpp | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/command.c b/src/command.c index b42b73a5c..2808e1f8c 100644 --- a/src/command.c +++ b/src/command.c @@ -855,8 +855,19 @@ static void COM_Exec_f(void) if (!COM_CheckParm("-silent")) CONS_Printf(M_GetText("executing %s\n"), COM_Argv(1)); - // insert text file into the command buffer - COM_ImmedExecute((char *)buf); + if (COM_CheckParm("-immediate")) + { + // immediately parses and executes all lines + // sidesteps wait from all sources, even self + COM_ImmedExecute((char *)buf); + } + else + { + // insert text file into the command buffer + // delays execution if interpreting wait cmd + COM_BufAddTextEx((char *)buf, com_flags); + COM_BufAddTextEx("\n", com_flags); + } // free buffer Z_Free(buf); diff --git a/src/deh_soc.c b/src/deh_soc.c index 32475d0a6..800e5b201 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -3533,7 +3533,7 @@ void readmaincfg(MYFILE *f, boolean mainfile) else if (fastcmp(word, "EXECCFG")) { if (strchr(word2, '.')) - COM_BufAddText(va("exec %s\n", word2)); + COM_BufAddText(va("exec \"%s\" -immediate\n", word2)); else { lumpnum_t lumpnum; diff --git a/src/m_misc.cpp b/src/m_misc.cpp index d6788a729..6f5b3474a 100644 --- a/src/m_misc.cpp +++ b/src/m_misc.cpp @@ -587,7 +587,7 @@ void Command_LoadConfig_f(void) CV_InitFilterVar(); // exec the config - COM_BufInsertText(va("exec \"%s\"\n", configfile)); + COM_BufInsertText(va("exec \"%s\" -immediate\n", configfile)); // don't filter anymore vars and don't let this convsvar be changed COM_BufInsertText(va("%s \"%d\"\n", cv_execversion.name, EXECVERSION)); @@ -648,7 +648,7 @@ void M_FirstLoadConfig(void) CV_InitFilterVar(); // load config, make sure those commands doesnt require the screen... - COM_BufInsertText(va("exec \"%s\"\n", configfile)); + COM_BufInsertText(va("exec \"%s\" -immediate\n", configfile)); // no COM_BufExecute() needed; that does it right away // don't filter anymore vars and don't let this convsvar be changed