summaryrefslogtreecommitdiff
path: root/core/variant_op.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/variant_op.cpp')
-rw-r--r--core/variant_op.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index fbb5e2631d..87d9738b06 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -552,6 +552,9 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
if (p_b.type==MATRIX32) {
_RETURN( *p_a._data._matrix32 * *p_b._data._matrix32 );
};
+ if (p_b.type==VECTOR2) {
+ _RETURN( p_a._data._matrix32->xform( *(const Vector2*)p_b._data._mem) );
+ };
r_valid=false;
return;
} break;
@@ -736,6 +739,24 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
}
#endif
_RETURN( p_a._data._int % p_b._data._int );
+
+ } else if (p_a.type==STRING) {
+ const String* format=reinterpret_cast<const String*>(p_a._data._mem);
+
+ String result;
+ bool error;
+ if (p_b.type==ARRAY) {
+ // e.g. "frog %s %d" % ["fish", 12]
+ const Array* args=reinterpret_cast<const Array*>(p_b._data._mem);
+ result=format->sprintf(*args, &error);
+ } else {
+ // e.g. "frog %d" % 12
+ Array args;
+ args.push_back(p_b);
+ result=format->sprintf(args, &error);
+ }
+ r_valid = !error;
+ _RETURN(result);
}
r_valid=false;