Skip to content

Commit

Permalink
Merge pull request #42012 from vnen/variant-fix-vectori-mult
Browse files Browse the repository at this point in the history
Fix Vector{2,3}i casting on Variant multiplication with numbers
  • Loading branch information
akien-mga committed Sep 13, 2020
2 parents 4331bea + 49e0cad commit 4372569
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions core/variant_op.cpp
Expand Up @@ -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) \
Expand Down

0 comments on commit 4372569

Please sign in to comment.