mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Short-circuiting "and" and "or" operators
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1461 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -74,6 +74,25 @@ ScriptValueP Context::eval(const Script& script, bool useScope) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Short-circuiting and/or = conditional jump without pop
|
||||
case I_JUMP_SC_AND: {
|
||||
bool condition = *stack.back();
|
||||
if (!condition) {
|
||||
instr = &script.instructions[0] + i.data;
|
||||
} else {
|
||||
stack.pop_back();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case I_JUMP_SC_OR: {
|
||||
bool condition = *stack.back();
|
||||
if (condition) {
|
||||
instr = &script.instructions[0] + i.data;
|
||||
} else {
|
||||
stack.pop_back();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Get a variable
|
||||
case I_GET_VAR: {
|
||||
|
||||
Reference in New Issue
Block a user