Fix Array For Each visual script node local vars setup

This commit is contained in:
Wojtek Figat
2023-07-04 17:58:32 +02:00
parent 90f377fa83
commit a14de5e255

View File

@@ -618,7 +618,7 @@ void VisualScriptExecutor::ProcessGroupFunction(Box* boxBase, Node* node, Value&
// Return // Return
case 5: case 5:
{ {
auto& scope = ThreadStacks.Get().Stack->Scope; auto scope = ThreadStacks.Get().Stack->Scope;
scope->FunctionReturn = tryGetValue(node->GetBox(1), Value::Zero); scope->FunctionReturn = tryGetValue(node->GetBox(1), Value::Zero);
break; break;
} }
@@ -634,7 +634,7 @@ void VisualScriptExecutor::ProcessGroupFunction(Box* boxBase, Node* node, Value&
else else
{ {
// Evaluate method parameter value from the current scope // Evaluate method parameter value from the current scope
auto& scope = ThreadStacks.Get().Stack->Scope; auto scope = ThreadStacks.Get().Stack->Scope;
int32 index = boxBase->ID - 1; int32 index = boxBase->ID - 1;
if (index < scope->Parameters.Length()) if (index < scope->Parameters.Length())
value = scope->Parameters.Get()[index]; value = scope->Parameters.Get()[index];
@@ -1138,7 +1138,7 @@ void VisualScriptExecutor::ProcessGroupFlow(Box* boxBase, Node* node, Value& val
break; break;
} }
int32 arrayIndex = 0; int32 arrayIndex = 0;
for (; iteratorIndex < scope->ReturnedValues.Count(); arrayIndex++) for (; arrayIndex < scope->ReturnedValues.Count(); arrayIndex++)
{ {
const auto& e = scope->ReturnedValues[arrayIndex]; const auto& e = scope->ReturnedValues[arrayIndex];
if (e.NodeId == node->ID && e.BoxId == 1) if (e.NodeId == node->ID && e.BoxId == 1)