Merge pull request #1752 from marauder2k9-torque/ScriptFix-ParentCallWithoutThis
Some checks are pending
Linux Build / Ubuntu Latest GCC (push) Waiting to run
MacOSX Build / MacOSX Latest Clang (push) Waiting to run
Windows Build / Windows Latest MSVC (push) Waiting to run

Script Fix for Parent call that does not use %this
This commit is contained in:
Brian Roberts 2026-05-31 11:36:15 -05:00 committed by GitHub
commit ebd409c2e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1981,10 +1981,22 @@ Con::EvalResult CodeBlock::exec(U32 ip, const char* functionName, Namespace* thi
}
else // it's a ParentCall
{
ConsoleValue& simObjectLookupValue = callArgv[1];
thisObject = getThisObject(simObjectLookupValue);
if (callArgc > 1)
{
ConsoleValue& simObjectLookupValue = callArgv[1];
thisObject = getThisObject(simObjectLookupValue);
}
if (thisObject == NULL)
// The grammar does NOT prepend anything. callArgv[1] is either
// a plain script argument (Parent::func(%arg)) or an explicitly
// passed %this (Parent::method(%this, %arg)) — the programmer's
// choice. For plain function parent calls callArgv[1] is never
// an object, so getThisObject returning NULL is expected and
// correct, not an error condition. The old guard was aborting
// these calls with a misleading "unable to find object" error
// using the value of %arg as the object name.
/*if (thisObject == NULL)
{
Con::warnf(
ConsoleLogEntry::General,
@ -1998,7 +2010,7 @@ Con::EvalResult CodeBlock::exec(U32 ip, const char* functionName, Namespace* thi
stack[_STK + 1].setEmptyString();
_STK++;
break;
}
}*/
if (thisNamespace)
{