From 4293aef8588b88184605d820e283138b16305053 Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Tue, 19 Oct 2021 20:34:57 -0400 Subject: [PATCH 1/2] This one slipped through - nextToken can't use local variable for its token variable. This was stated as one of the breaking changes in the origional PR. --- Engine/source/console/consoleFunctions.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index 9a57c31c1..ceac8de6d 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/Engine/source/console/consoleFunctions.cpp @@ -1703,12 +1703,7 @@ DefineEngineFunction( nextToken, const char*, ( const char* str1, const char* to if (*str) *str++ = 0; - // set local variable if inside a function - if (gEvalState.getStackDepth() > 0 && - gEvalState.getCurrentFrame().scopeName) - Con::setLocalVariable(token,tmp); - else - Con::setVariable(token,tmp); + Con::setVariable(token,tmp); // advance str past the 'delim space' while (isInSet(*str, delim)) From 4af4d90f4a874cb14d9d2216b5260d81bf136b59 Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Tue, 19 Oct 2021 20:38:13 -0400 Subject: [PATCH 2/2] Get rid of setLocalVariable entirely. --- Engine/source/console/console.cpp | 6 ------ Engine/source/console/console.h | 9 --------- 2 files changed, 15 deletions(-) diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index 643f8cbec..750db2a17 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -861,12 +861,6 @@ void setVariable(const char *name, const char *value) } } -void setLocalVariable(const char *name, const char *value) -{ - name = prependPercent(name); - gEvalState.getCurrentFrame().setVariable(StringTable->insert(name), value); -} - void setBoolVariable(const char *varName, bool value) { SimObject *obj = NULL; diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index 5c72f34e1..8816e4e99 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -720,15 +720,6 @@ namespace Con /// void removeVariableNotify(const char *name, const NotifyDelegate &callback); - /// Assign a string value to a locally scoped console variable - /// - /// @note The context of the variable is determined by gEvalState; that is, - /// by the currently executing code. - /// - /// @param name Local console variable name to set - /// @param value String value to assign to name - void setLocalVariable(const char *name, const char *value); - /// Retrieve the string value to a locally scoped console variable /// /// @note The context of the variable is determined by gEvalState; that is,