diff options
author | George Marques <george@gmarqu.es> | 2020-09-12 17:16:25 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2020-09-12 17:23:34 -0300 |
commit | 49e0cadccabb7b86f0d5522598b2e18f9c399a5b (patch) | |
tree | fe8e1dc618245189b5a176a3eaf46e54f32fd755 | |
parent | 463879db56cc1e2417a02696e41ae3c40324ac24 (diff) |
Fix Vector{2,3}i casting on Variant multiplication with numbers
-rw-r--r-- | core/variant_op.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/core/variant_op.cpp b/core/variant_op.cpp index 95b488230d..ec4eea05bf 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -245,22 +245,22 @@ bool Variant::booleanize() const { _RETURN(p_a._data.m_type); \ } -#define DEFAULT_OP_NUM_VEC(m_prefix, m_op_name, m_name, m_op, m_type) \ - CASE_TYPE(m_prefix, m_op_name, m_name) { \ - if (p_b.type == INT) \ - _RETURN(p_a._data.m_type m_op p_b._data._int); \ - if (p_b.type == FLOAT) \ - _RETURN(p_a._data.m_type m_op p_b._data._float); \ - if (p_b.type == VECTOR2) \ - _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector2 *>(p_b._data._mem)); \ - if (p_b.type == VECTOR3) \ - _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector3 *>(p_b._data._mem)); \ - if (p_b.type == VECTOR2I) \ - _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector2 *>(p_b._data._mem)); \ - if (p_b.type == VECTOR3I) \ - _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector3 *>(p_b._data._mem)); \ - \ - _RETURN_FAIL \ +#define DEFAULT_OP_NUM_VEC(m_prefix, m_op_name, m_name, m_op, m_type) \ + CASE_TYPE(m_prefix, m_op_name, m_name) { \ + if (p_b.type == INT) \ + _RETURN(p_a._data.m_type m_op p_b._data._int); \ + if (p_b.type == FLOAT) \ + _RETURN(p_a._data.m_type m_op p_b._data._float); \ + if (p_b.type == VECTOR2) \ + _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector2 *>(p_b._data._mem)); \ + if (p_b.type == VECTOR3) \ + _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector3 *>(p_b._data._mem)); \ + if (p_b.type == VECTOR2I) \ + _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector2i *>(p_b._data._mem)); \ + if (p_b.type == VECTOR3I) \ + _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector3i *>(p_b._data._mem)); \ + \ + _RETURN_FAIL \ } #define DEFAULT_OP_STR_REV(m_prefix, m_op_name, m_name, m_op, m_type) \ |