diff options
Diffstat (limited to 'core/variant/variant.h')
-rw-r--r-- | core/variant/variant.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/core/variant/variant.h b/core/variant/variant.h index 212f94a9a8..b0738e7d44 100644 --- a/core/variant/variant.h +++ b/core/variant/variant.h @@ -552,9 +552,6 @@ public: void zero(); Variant duplicate(bool p_deep = false) const; Variant recursive_duplicate(bool p_deep, int recursion_count) const; - static void blend(const Variant &a, const Variant &b, float c, Variant &r_dst); - static void interpolate(const Variant &a, const Variant &b, float c, Variant &r_dst); - static void sub(const Variant &a, const Variant &b, Variant &r_dst); /* Built-In Methods */ @@ -807,7 +804,22 @@ const Variant::ObjData &Variant::_get_obj() const { return *reinterpret_cast<const ObjData *>(&_data._mem[0]); } -String vformat(const String &p_text, const Variant &p1 = Variant(), const Variant &p2 = Variant(), const Variant &p3 = Variant(), const Variant &p4 = Variant(), const Variant &p5 = Variant()); +template <typename... VarArgs> +String vformat(const String &p_text, const VarArgs... p_args) { + Variant args[sizeof...(p_args) + 1] = { p_args..., Variant() }; // +1 makes sure zero sized arrays are also supported. + Array args_array; + args_array.resize(sizeof...(p_args)); + for (uint32_t i = 0; i < sizeof...(p_args); i++) { + args_array[i] = args[i]; + } + + bool error = false; + String fmt = p_text.sprintf(args_array, &error); + + ERR_FAIL_COND_V_MSG(error, String(), fmt); + + return fmt; +} template <typename... VarArgs> Callable Callable::bind(VarArgs... p_args) { |