mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
"div" operator for integer division,
Added parser support for closure operator fun@(args) Use equal() function for all script comparisons, better support for deciding when to use strings and when to use pointers equality. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@964 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -173,24 +173,6 @@ SCRIPT_FUNCTION(remove_tags) {
|
||||
|
||||
// ----------------------------------------------------------------------------- : Collection stuff
|
||||
|
||||
/// compare script values for equallity
|
||||
bool equal(const ScriptValue& a, const ScriptValue& b) {
|
||||
if (&a == &b) return true;
|
||||
ScriptType at = a.type(), bt = b.type();
|
||||
if (at != bt) {
|
||||
return false;
|
||||
} else if (at == SCRIPT_INT) {
|
||||
return (int)a == (int)b;
|
||||
} else if (at == SCRIPT_DOUBLE) {
|
||||
return (double)a == (double)b;
|
||||
} else if (at == SCRIPT_STRING) {
|
||||
return a.toString() == b.toString();
|
||||
} else {
|
||||
// compare pointers, must be equal and not null
|
||||
const void *ap = a.comparePointer(), *bp = b.comparePointer();
|
||||
return (ap && ap == bp);
|
||||
}
|
||||
}
|
||||
|
||||
/// position of some element in a vector
|
||||
/** 0 based index, -1 if not found */
|
||||
|
||||
Reference in New Issue
Block a user