1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 08:15:37 +00:00

allow additional string argument for stopcombat and addspell (ignored)

This commit is contained in:
Marc Zinnschlag 2014-02-12 08:53:37 +01:00
parent 6a5d88b640
commit 61626e90da
3 changed files with 17 additions and 13 deletions

View file

@ -705,11 +705,11 @@ namespace Compiler
{
optional = true;
}
else if (*iter=='S' || *iter=='c')
else if (*iter=='S' || *iter=='c' || *iter=='x')
{
stringParser.reset();
if (optional)
if (optional || *iter=='x')
stringParser.setOptional (true);
if (*iter=='c') stringParser.smashCase();
@ -718,18 +718,21 @@ namespace Compiler
if (optional && stringParser.isEmpty())
break;
if (invert)
if (*iter!='x')
{
std::vector<Interpreter::Type_Code> tmp;
stringParser.append (tmp);
if (invert)
{
std::vector<Interpreter::Type_Code> tmp;
stringParser.append (tmp);
stack.push (tmp);
stack.push (tmp);
}
else
stringParser.append (code);
if (optional)
++optionalCount;
}
else
stringParser.append (code);
if (optional)
++optionalCount;
}
else
{

View file

@ -101,6 +101,7 @@ namespace Compiler
/// \param arguments Each character represents one arguments ('l': integer,
/// 'f': float, 'S': string, 'c': string (case smashed), '/': following arguments are
/// optional)
/// 'x': optional string that will be ignored (die in a fire, MW script compiler!)
/// \param invert Store arguments in reverted order.
/// \return number of optional arguments
};

View file

@ -62,7 +62,7 @@ namespace Compiler
extensions.registerInstruction ("toggleai", "", opcodeToggleAI, opcodeToggleAI);
extensions.registerInstruction ("tai", "", opcodeToggleAI, opcodeToggleAI);
extensions.registerInstruction("startcombat", "c", opcodeStartCombat, opcodeStartCombatExplicit);
extensions.registerInstruction("stopcombat", "", opcodeStopCombat, opcodeStopCombatExplicit);
extensions.registerInstruction("stopcombat", "x", opcodeStopCombat, opcodeStopCombatExplicit);
extensions.registerFunction ("gethello", 'l', "", opcodeGetHello, opcodeGetHelloExplicit);
extensions.registerFunction ("getfight", 'l', "", opcodeGetFight, opcodeGetFightExplicit);
extensions.registerFunction ("getflee", 'l', "", opcodeGetFlee, opcodeGetFleeExplicit);
@ -398,7 +398,7 @@ namespace Compiler
extensions.registerInstruction ("setpccrimelevel", "f", opcodeSetPCCrimeLevel);
extensions.registerInstruction ("modpccrimelevel", "f", opcodeModPCCrimeLevel);
extensions.registerInstruction ("addspell", "c", opcodeAddSpell, opcodeAddSpellExplicit);
extensions.registerInstruction ("addspell", "cx", opcodeAddSpell, opcodeAddSpellExplicit);
extensions.registerInstruction ("removespell", "c", opcodeRemoveSpell,
opcodeRemoveSpellExplicit);
extensions.registerInstruction ("removespelleffects", "c", opcodeRemoveSpellEffects,