Implement operator != on Pool*Array types

These types previously had equality checks but not inequality checks.
Add these too.

This fixes #11466
This commit is contained in:
Hein-Pieter van Braam 2017-09-21 22:07:31 +02:00
parent 3237e05c36
commit 7b492e6a23

View file

@ -334,6 +334,13 @@ bool Variant::booleanize() const {
DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, !=, !=, true, false, false) \ DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, !=, !=, true, false, false) \
} }
#define DEFAULT_OP_ARRAY_NEQ(m_prefix, m_op_name, m_name, m_type) \
CASE_TYPE(m_prefix, m_op_name, m_name) { \
if (p_b.type == NIL) \
_RETURN(true) \
DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, !=, ==, true, true, false) \
}
#define DEFAULT_OP_ARRAY_LT(m_prefix, m_op_name, m_name, m_type) \ #define DEFAULT_OP_ARRAY_LT(m_prefix, m_op_name, m_name, m_type) \
DEFAULT_OP_ARRAY_OP(m_prefix, m_op_name, m_name, m_type, <, !=, false, a_len < array_b.size(), true) DEFAULT_OP_ARRAY_OP(m_prefix, m_op_name, m_name, m_type, <, !=, false, a_len < array_b.size(), true)
@ -555,14 +562,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
DEFAULT_OP_STR_NULL(math, OP_NOT_EQUAL, NODE_PATH, !=, NodePath); DEFAULT_OP_STR_NULL(math, OP_NOT_EQUAL, NODE_PATH, !=, NodePath);
DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, _RID, !=, RID); DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, _RID, !=, RID);
CASE_TYPE(math, OP_NOT_EQUAL, POOL_BYTE_ARRAY); DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_BYTE_ARRAY, uint8_t);
CASE_TYPE(math, OP_NOT_EQUAL, POOL_INT_ARRAY); DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_INT_ARRAY, int);
CASE_TYPE(math, OP_NOT_EQUAL, POOL_REAL_ARRAY); DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_REAL_ARRAY, real_t);
CASE_TYPE(math, OP_NOT_EQUAL, POOL_STRING_ARRAY); DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_STRING_ARRAY, String);
CASE_TYPE(math, OP_NOT_EQUAL, POOL_VECTOR2_ARRAY); DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_VECTOR2_ARRAY, Vector2);
CASE_TYPE(math, OP_NOT_EQUAL, POOL_VECTOR3_ARRAY); DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_VECTOR3_ARRAY, Vector3);
CASE_TYPE(math, OP_NOT_EQUAL, POOL_COLOR_ARRAY); DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_COLOR_ARRAY, Color);
_RETURN_FAIL;
} }
SWITCH_OP(math, OP_LESS, p_a.type) { SWITCH_OP(math, OP_LESS, p_a.type) {