mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Added ^ power operator,
Added abs, random_int, random_real, random_shuffle, random_select script functions. Made == comparison of doubles use a small epsilon, so things like 3/2 == 1.5 are actually true. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1013 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -402,6 +402,13 @@ void instrBinary (BinaryInstructionType i, ScriptValueP& a, const ScriptValueP&
|
||||
a = to_script((int)*a % (int)*b);
|
||||
}
|
||||
break;
|
||||
case I_POW:
|
||||
if (at == SCRIPT_DOUBLE || bt == SCRIPT_DOUBLE) {
|
||||
a = to_script(pow((double)*a, (double)*b));
|
||||
} else {
|
||||
a = to_script(pow((int)*a, (int)*b));
|
||||
}
|
||||
break;
|
||||
case I_AND: OPERATOR_B(&&);
|
||||
case I_OR: OPERATOR_B(||);
|
||||
case I_XOR: OPERATOR_B(!=);
|
||||
@@ -442,7 +449,7 @@ void instrQuaternary(QuaternaryInstructionType i, ScriptValueP& a, const ScriptV
|
||||
// ----------------------------------------------------------------------------- : Simple instructions : objects and closures
|
||||
|
||||
void Context::makeObject(size_t n) {
|
||||
intrusive_ptr<ScriptCustomCollection> ret(new ScriptCustomCollection());
|
||||
ScriptCustomCollectionP ret(new ScriptCustomCollection());
|
||||
size_t begin = stack.size() - 2 * n;
|
||||
for (size_t i = 0 ; i < n ; ++i) {
|
||||
const ScriptValueP& key = stack[begin + 2 * i];
|
||||
|
||||
Reference in New Issue
Block a user