Merge pull request #720 from Areloch/SimGroupSimSetCheck

Changes the -> syntax check from exclusively checking simgroups to checking simsets, allowing both to be used
This commit is contained in:
Brian Roberts 2022-01-21 17:45:35 -06:00 committed by GitHub
commit 024dcfaabd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1620,17 +1620,17 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
++ip; // To skip the recurse flag if the object wasnt found ++ip; // To skip the recurse flag if the object wasnt found
if (curObject) if (curObject)
{ {
SimGroup* group = dynamic_cast<SimGroup*>(curObject); SimSet* set = dynamic_cast<SimSet*>(curObject);
if (group) if (set)
{ {
StringTableEntry intName = StringTable->insert(stack[_STK].getString()); StringTableEntry intName = StringTable->insert(stack[_STK].getString());
bool recurse = code[ip - 1]; bool recurse = code[ip - 1];
SimObject* obj = group->findObjectByInternalName(intName, recurse); SimObject* obj = set->findObjectByInternalName(intName, recurse);
stack[_STK].setInt(obj ? obj->getId() : 0); stack[_STK].setInt(obj ? obj->getId() : 0);
} }
else else
{ {
Con::errorf(ConsoleLogEntry::Script, "%s: Attempt to use -> on non-group %s of class %s.", getFileLine(ip - 2), curObject->getName(), curObject->getClassName()); Con::errorf(ConsoleLogEntry::Script, "%s: Attempt to use -> on non-set %s of class %s.", getFileLine(ip - 2), curObject->getName(), curObject->getClassName());
stack[_STK].setInt(0); stack[_STK].setInt(0);
} }
} }