mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-06 09:45:33 +00:00
Merge pull request #2341 from Capostrophic/scripting
Allow using functions in non-conditional expressions (bug #3725)
This commit is contained in:
commit
e0edecf1f2
2 changed files with 32 additions and 17 deletions
|
@ -7,6 +7,7 @@
|
|||
Bug #3109: SetPos/Position handles actors differently
|
||||
Bug #3282: Unintended behaviour when assigning F3 and Windows keys
|
||||
Bug #3623: Display scaling breaks mouse recognition
|
||||
Bug #3725: Using script function in a non-conditional expression breaks script compilation
|
||||
Bug #3733: Normal maps are inverted on mirrored UVs
|
||||
Bug #3765: DisableTeleporting makes Mark/Recall/Intervention effects undetectable
|
||||
Bug #3778: [Mod] Improved Thrown Weapon Projectiles - weapons have wrong transformation during throw animation
|
||||
|
|
|
@ -323,36 +323,50 @@ namespace Compiler
|
|||
}
|
||||
}
|
||||
|
||||
if (mAllowExpression)
|
||||
if (keyword==Scanner::K_getdisabled || keyword==Scanner::K_getdistance)
|
||||
{
|
||||
if (keyword==Scanner::K_getdisabled || keyword==Scanner::K_getdistance)
|
||||
if (mAllowExpression)
|
||||
{
|
||||
scanner.putbackKeyword (keyword, loc);
|
||||
parseExpression (scanner, loc);
|
||||
mState = EndState;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (const Extensions *extensions = getContext().getExtensions())
|
||||
else
|
||||
{
|
||||
char returnType;
|
||||
std::string argumentType;
|
||||
getErrorHandler().warning ("Unexpected naked expression", loc);
|
||||
}
|
||||
mState = EndState;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool hasExplicit = !mExplicit.empty();
|
||||
if (const Extensions *extensions = getContext().getExtensions())
|
||||
{
|
||||
char returnType;
|
||||
std::string argumentType;
|
||||
|
||||
if (extensions->isFunction (keyword, returnType, argumentType, hasExplicit))
|
||||
bool hasExplicit = mState==ExplicitState;
|
||||
|
||||
if (extensions->isFunction (keyword, returnType, argumentType, hasExplicit))
|
||||
{
|
||||
if (!hasExplicit && mState==ExplicitState)
|
||||
{
|
||||
if (!hasExplicit && !mExplicit.empty())
|
||||
{
|
||||
getErrorHandler().warning ("Stray explicit reference", loc);
|
||||
mExplicit.clear();
|
||||
}
|
||||
getErrorHandler().warning ("Stray explicit reference", loc);
|
||||
mExplicit.clear();
|
||||
}
|
||||
|
||||
if (mAllowExpression)
|
||||
{
|
||||
scanner.putbackKeyword (keyword, loc);
|
||||
parseExpression (scanner, loc);
|
||||
mState = EndState;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<Interpreter::Type_Code> code;
|
||||
int optionals = mExprParser.parseArguments (argumentType, scanner, code, keyword);
|
||||
mCode.insert(mCode.end(), code.begin(), code.end());
|
||||
extensions->generateFunctionCode (keyword, mCode, mLiterals, mExplicit, optionals);
|
||||
}
|
||||
mState = EndState;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue