diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fa1c7683e..fac0b4ac04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ Bug #4837: CTD when a mesh with NiLODNode root node with particles is loaded Bug #4860: Actors outside of processing range visible for one frame after spawning Bug #4876: AI ratings handling inconsistencies + Bug #4888: Global variable stray explicit reference calls break script compilation Feature #2229: Improve pathfinding AI Feature #3442: Default values for fallbacks from ini file Feature #3610: Option to invert X axis diff --git a/components/compiler/exprparser.cpp b/components/compiler/exprparser.cpp index 6b849ec3aa..b3fd1e5ae1 100644 --- a/components/compiler/exprparser.cpp +++ b/components/compiler/exprparser.cpp @@ -277,10 +277,18 @@ namespace Compiler { if (!mExplicit.empty()) { - if (mMemberOp && handleMemberAccess (name)) - return true; + if (!mRefOp) + { + if (mMemberOp && handleMemberAccess (name)) + return true; - return Parser::parseName (name, loc, scanner); + return Parser::parseName (name, loc, scanner); + } + else + { + mExplicit.clear(); + getErrorHandler().warning ("Ignoring stray explicit reference", loc); + } } mFirst = false; diff --git a/components/compiler/lineparser.cpp b/components/compiler/lineparser.cpp index 3f9d2e7903..1cfa70f733 100644 --- a/components/compiler/lineparser.cpp +++ b/components/compiler/lineparser.cpp @@ -506,6 +506,13 @@ namespace Compiler return true; } + if (code==Scanner::S_ref && mState==SetPotentialMemberVarState) + { + getErrorHandler().warning ("Ignoring stray explicit reference", loc); + mState = SetState; + return true; + } + if (code==Scanner::S_ref && mState==PotentialExplicitState) { mState = ExplicitState;