1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-04-10 15:45:37 +00:00

Allow garbage integer argument for addSpell (Fixes #1539)

This commit is contained in:
scrawl 2014-06-23 22:02:22 +02:00
parent 320ab1b2c1
commit 750d8b5589
3 changed files with 14 additions and 10 deletions

View File

@ -775,7 +775,7 @@ namespace Compiler
{
parser.reset();
if (optional)
if (optional || *iter == 'X')
parser.setOptional (true);
scanner.scan (parser);
@ -783,6 +783,8 @@ namespace Compiler
if (optional && parser.isEmpty())
break;
if (*iter != 'X')
{
std::vector<Interpreter::Type_Code> tmp;
char type = parser.append (tmp);
@ -796,6 +798,7 @@ namespace Compiler
++optionalCount;
}
}
}
while (!stack.empty())
{

View File

@ -20,7 +20,8 @@ namespace Compiler
l - Integer <BR>
s - Short <BR>
S - String, case preserved <BR>
x - Optional, ignored argument
x - Optional, ignored string argument
X - Optional, ignored integer argument
**/
typedef std::string ScriptArgs;

View File

@ -405,7 +405,7 @@ namespace Compiler
extensions.registerInstruction ("setpccrimelevel", "f", opcodeSetPCCrimeLevel);
extensions.registerInstruction ("modpccrimelevel", "f", opcodeModPCCrimeLevel);
extensions.registerInstruction ("addspell", "cx", opcodeAddSpell, opcodeAddSpellExplicit);
extensions.registerInstruction ("addspell", "cxX", opcodeAddSpell, opcodeAddSpellExplicit);
extensions.registerInstruction ("removespell", "c", opcodeRemoveSpell,
opcodeRemoveSpellExplicit);
extensions.registerInstruction ("removespelleffects", "c", opcodeRemoveSpellEffects,