Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
Part of #33027, also discussed in #29848. Enforcing the use of brackets even on single line statements would be preferred, but `clang-format` doesn't have this functionality yet.
This commit is contained in:
parent
03b13e0c69
commit
e956e80c1f
130 changed files with 967 additions and 511 deletions
|
|
@ -1456,16 +1456,19 @@ Variant ClassDB::class_get_default_property_value(const StringName &p_class, con
|
|||
}
|
||||
|
||||
if (!default_values.has(p_class)) {
|
||||
if (r_valid != nullptr) *r_valid = false;
|
||||
if (r_valid != nullptr)
|
||||
*r_valid = false;
|
||||
return Variant();
|
||||
}
|
||||
|
||||
if (!default_values[p_class].has(p_property)) {
|
||||
if (r_valid != nullptr) *r_valid = false;
|
||||
if (r_valid != nullptr)
|
||||
*r_valid = false;
|
||||
return Variant();
|
||||
}
|
||||
|
||||
if (r_valid != nullptr) *r_valid = true;
|
||||
if (r_valid != nullptr)
|
||||
*r_valid = true;
|
||||
return default_values[p_class][p_property];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -406,7 +406,8 @@ bool Color::html_is_valid(const String &p_color) {
|
|||
}
|
||||
|
||||
Color Color::named(const String &p_name) {
|
||||
if (_named_colors.empty()) _populate_named_colors(); // from color_names.inc
|
||||
if (_named_colors.empty())
|
||||
_populate_named_colors(); // from color_names.inc
|
||||
String name = p_name;
|
||||
// Normalize name
|
||||
name = name.replace(" ", "");
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
static Map<String, Color> _named_colors;
|
||||
static void _populate_named_colors() {
|
||||
if (!_named_colors.empty()) return;
|
||||
if (!_named_colors.empty())
|
||||
return;
|
||||
_named_colors.insert("aliceblue", Color(0.94, 0.97, 1.00));
|
||||
_named_colors.insert("antiquewhite", Color(0.98, 0.92, 0.84));
|
||||
_named_colors.insert("aqua", Color(0.00, 1.00, 1.00));
|
||||
|
|
|
|||
|
|
@ -253,7 +253,8 @@
|
|||
cmd->method = p_method; \
|
||||
SEMIC_SEP_LIST(CMD_ASSIGN_PARAM, N); \
|
||||
unlock(); \
|
||||
if (sync) sync->post(); \
|
||||
if (sync) \
|
||||
sync->post(); \
|
||||
}
|
||||
|
||||
#define CMD_RET_TYPE(N) CommandRet##N<T, M, COMMA_SEP_LIST(TYPE_ARG, N) COMMA(N) R>
|
||||
|
|
@ -269,7 +270,8 @@
|
|||
cmd->ret = r_ret; \
|
||||
cmd->sync_sem = ss; \
|
||||
unlock(); \
|
||||
if (sync) sync->post(); \
|
||||
if (sync) \
|
||||
sync->post(); \
|
||||
ss->sem.wait(); \
|
||||
ss->in_use = false; \
|
||||
}
|
||||
|
|
@ -286,7 +288,8 @@
|
|||
SEMIC_SEP_LIST(CMD_ASSIGN_PARAM, N); \
|
||||
cmd->sync_sem = ss; \
|
||||
unlock(); \
|
||||
if (sync) sync->post(); \
|
||||
if (sync) \
|
||||
sync->post(); \
|
||||
ss->sem.wait(); \
|
||||
ss->in_use = false; \
|
||||
}
|
||||
|
|
@ -418,12 +421,14 @@ class CommandQueueMT {
|
|||
}
|
||||
|
||||
bool flush_one(bool p_lock = true) {
|
||||
if (p_lock) lock();
|
||||
if (p_lock)
|
||||
lock();
|
||||
tryagain:
|
||||
|
||||
// tried to read an empty queue
|
||||
if (read_ptr == write_ptr) {
|
||||
if (p_lock) unlock();
|
||||
if (p_lock)
|
||||
unlock();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -442,15 +447,18 @@ class CommandQueueMT {
|
|||
|
||||
read_ptr += size;
|
||||
|
||||
if (p_lock) unlock();
|
||||
if (p_lock)
|
||||
unlock();
|
||||
cmd->call();
|
||||
if (p_lock) lock();
|
||||
if (p_lock)
|
||||
lock();
|
||||
|
||||
cmd->post();
|
||||
cmd->~CommandBase();
|
||||
*(uint32_t *)&command_mem[size_ptr] &= ~1;
|
||||
|
||||
if (p_lock) unlock();
|
||||
if (p_lock)
|
||||
unlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3152,11 +3152,13 @@ void Image::bumpmap_to_normalmap(float bump_scale) {
|
|||
|
||||
for (int ty = 0; ty < height; ty++) {
|
||||
int py = ty + 1;
|
||||
if (py >= height) py -= height;
|
||||
if (py >= height)
|
||||
py -= height;
|
||||
|
||||
for (int tx = 0; tx < width; tx++) {
|
||||
int px = tx + 1;
|
||||
if (px >= width) px -= width;
|
||||
if (px >= width)
|
||||
px -= width;
|
||||
float here = read_ptr[ty * width + tx];
|
||||
float to_right = read_ptr[ty * width + px];
|
||||
float above = read_ptr[py * width + tx];
|
||||
|
|
|
|||
|
|
@ -414,7 +414,8 @@ Error DirAccessPack::change_dir(String p_dir) {
|
|||
|
||||
nd = nd.simplify_path();
|
||||
|
||||
if (nd == "") nd = ".";
|
||||
if (nd == "")
|
||||
nd = ".";
|
||||
|
||||
if (nd.begins_with("/")) {
|
||||
nd = nd.replace_first("/", "");
|
||||
|
|
|
|||
|
|
@ -52,16 +52,20 @@ protected:
|
|||
public:
|
||||
//operator Variant() const;
|
||||
bool operator==(const IP_Address &p_ip) const {
|
||||
if (p_ip.valid != valid) return false;
|
||||
if (!valid) return false;
|
||||
if (p_ip.valid != valid)
|
||||
return false;
|
||||
if (!valid)
|
||||
return false;
|
||||
for (int i = 0; i < 4; i++)
|
||||
if (field32[i] != p_ip.field32[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
bool operator!=(const IP_Address &p_ip) const {
|
||||
if (p_ip.valid != valid) return true;
|
||||
if (!valid) return true;
|
||||
if (p_ip.valid != valid)
|
||||
return true;
|
||||
if (!valid)
|
||||
return true;
|
||||
for (int i = 0; i < 4; i++)
|
||||
if (field32[i] != p_ip.field32[i])
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -121,7 +121,8 @@ static inline int encode_cstring(const char *p_string, uint8_t *p_data) {
|
|||
len++;
|
||||
};
|
||||
|
||||
if (p_data) *p_data = 0;
|
||||
if (p_data)
|
||||
*p_data = 0;
|
||||
return len + 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,8 @@ void MultiplayerAPI::set_root_node(Node *p_node) {
|
|||
|
||||
void MultiplayerAPI::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_peer) {
|
||||
|
||||
if (p_peer == network_peer) return; // Nothing to do
|
||||
if (p_peer == network_peer)
|
||||
return; // Nothing to do
|
||||
|
||||
ERR_FAIL_COND_MSG(p_peer.is_valid() && p_peer->get_connection_status() == NetworkedMultiplayerPeer::CONNECTION_DISCONNECTED,
|
||||
"Supplied NetworkedMultiplayerPeer must be connecting or connected.");
|
||||
|
|
@ -787,8 +788,9 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p
|
|||
|
||||
int ofs = 0;
|
||||
|
||||
#define MAKE_ROOM(m_amount) \
|
||||
if (packet_cache.size() < m_amount) packet_cache.resize(m_amount);
|
||||
#define MAKE_ROOM(m_amount) \
|
||||
if (packet_cache.size() < m_amount) \
|
||||
packet_cache.resize(m_amount);
|
||||
|
||||
// Encode meta.
|
||||
// The meta is composed by a single byte that contains (starting from the least segnificant bit):
|
||||
|
|
|
|||
|
|
@ -160,7 +160,8 @@ public:
|
|||
static bool get_timestamp_on_load() { return timestamp_on_load; }
|
||||
|
||||
static void notify_load_error(const String &p_err) {
|
||||
if (err_notify) err_notify(err_notify_ud, p_err);
|
||||
if (err_notify)
|
||||
err_notify(err_notify_ud, p_err);
|
||||
}
|
||||
static void set_error_notify_func(void *p_ud, ResourceLoadErrorNotify p_err_notify) {
|
||||
err_notify = p_err_notify;
|
||||
|
|
@ -168,7 +169,8 @@ public:
|
|||
}
|
||||
|
||||
static void notify_dependency_error(const String &p_path, const String &p_dependency, const String &p_type) {
|
||||
if (dep_err_notify) dep_err_notify(dep_err_notify_ud, p_path, p_dependency, p_type);
|
||||
if (dep_err_notify)
|
||||
dep_err_notify(dep_err_notify_ud, p_path, p_dependency, p_type);
|
||||
}
|
||||
static void set_dependency_error_notify_func(void *p_ud, DependencyErrorNotify p_err_notify) {
|
||||
dep_err_notify = p_err_notify;
|
||||
|
|
|
|||
|
|
@ -353,7 +353,8 @@ public:
|
|||
|
||||
Element *it = front();
|
||||
while (it) {
|
||||
if (it->value == p_val) return it;
|
||||
if (it->value == p_val)
|
||||
return it;
|
||||
it = it->next();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,8 @@ void AStar::connect_points(int p_id, int p_with_id, bool bidirectional) {
|
|||
}
|
||||
|
||||
Segment s(p_id, p_with_id);
|
||||
if (bidirectional) s.direction = Segment::BIDIRECTIONAL;
|
||||
if (bidirectional)
|
||||
s.direction = Segment::BIDIRECTIONAL;
|
||||
|
||||
Set<Segment>::Element *element = segments.find(s);
|
||||
if (element != nullptr) {
|
||||
|
|
@ -290,7 +291,8 @@ int AStar::get_closest_point(const Vector3 &p_point, bool p_include_disabled) co
|
|||
|
||||
for (OAHashMap<int, Point *>::Iterator it = points.iter(); it.valid; it = points.next_iter(it)) {
|
||||
|
||||
if (!p_include_disabled && !(*it.value)->enabled) continue; // Disabled points should not be considered.
|
||||
if (!p_include_disabled && !(*it.value)->enabled)
|
||||
continue; // Disabled points should not be considered.
|
||||
|
||||
real_t d = p_point.distance_squared_to((*it.value)->pos);
|
||||
if (closest_id < 0 || d < closest_dist) {
|
||||
|
|
@ -340,7 +342,8 @@ bool AStar::_solve(Point *begin_point, Point *end_point) {
|
|||
|
||||
pass++;
|
||||
|
||||
if (!end_point->enabled) return false;
|
||||
if (!end_point->enabled)
|
||||
return false;
|
||||
|
||||
bool found_route = false;
|
||||
|
||||
|
|
@ -451,7 +454,8 @@ Vector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) {
|
|||
Point *end_point = b;
|
||||
|
||||
bool found_route = _solve(begin_point, end_point);
|
||||
if (!found_route) return Vector<Vector3>();
|
||||
if (!found_route)
|
||||
return Vector<Vector3>();
|
||||
|
||||
Point *p = end_point;
|
||||
int pc = 1; // Begin point
|
||||
|
|
@ -499,7 +503,8 @@ Vector<int> AStar::get_id_path(int p_from_id, int p_to_id) {
|
|||
Point *end_point = b;
|
||||
|
||||
bool found_route = _solve(begin_point, end_point);
|
||||
if (!found_route) return Vector<int>();
|
||||
if (!found_route)
|
||||
return Vector<int>();
|
||||
|
||||
Point *p = end_point;
|
||||
int pc = 1; // Begin point
|
||||
|
|
@ -729,7 +734,8 @@ Vector<Vector2> AStar2D::get_point_path(int p_from_id, int p_to_id) {
|
|||
AStar::Point *end_point = b;
|
||||
|
||||
bool found_route = _solve(begin_point, end_point);
|
||||
if (!found_route) return Vector<Vector2>();
|
||||
if (!found_route)
|
||||
return Vector<Vector2>();
|
||||
|
||||
AStar::Point *p = end_point;
|
||||
int pc = 1; // Begin point
|
||||
|
|
@ -777,7 +783,8 @@ Vector<int> AStar2D::get_id_path(int p_from_id, int p_to_id) {
|
|||
AStar::Point *end_point = b;
|
||||
|
||||
bool found_route = _solve(begin_point, end_point);
|
||||
if (!found_route) return Vector<int>();
|
||||
if (!found_route)
|
||||
return Vector<int>();
|
||||
|
||||
AStar::Point *p = end_point;
|
||||
int pc = 1; // Begin point
|
||||
|
|
@ -809,7 +816,8 @@ bool AStar2D::_solve(AStar::Point *begin_point, AStar::Point *end_point) {
|
|||
|
||||
astar.pass++;
|
||||
|
||||
if (!end_point->enabled) return false;
|
||||
if (!end_point->enabled)
|
||||
return false;
|
||||
|
||||
bool found_route = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -783,7 +783,8 @@ void Basis::get_axis_angle(Vector3 &r_axis, real_t &r_angle) const {
|
|||
real_t s = Math::sqrt((elements[1][2] - elements[2][1]) * (elements[1][2] - elements[2][1]) + (elements[2][0] - elements[0][2]) * (elements[2][0] - elements[0][2]) + (elements[0][1] - elements[1][0]) * (elements[0][1] - elements[1][0])); // s=|axis||sin(angle)|, used to normalise
|
||||
|
||||
angle = Math::acos((elements[0][0] + elements[1][1] + elements[2][2] - 1) / 2);
|
||||
if (angle < 0) s = -s;
|
||||
if (angle < 0)
|
||||
s = -s;
|
||||
x = (elements[2][1] - elements[1][2]) / s;
|
||||
y = (elements[0][2] - elements[2][0]) / s;
|
||||
z = (elements[1][0] - elements[0][1]) / s;
|
||||
|
|
|
|||
|
|
@ -473,20 +473,23 @@ void CameraMatrix::invert() {
|
|||
|
||||
/** Divide column by minus pivot value **/
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (i != k) matrix[i][k] /= (-pvt_val);
|
||||
if (i != k)
|
||||
matrix[i][k] /= (-pvt_val);
|
||||
}
|
||||
|
||||
/** Reduce the matrix **/
|
||||
for (i = 0; i < 4; i++) {
|
||||
hold = matrix[i][k];
|
||||
for (j = 0; j < 4; j++) {
|
||||
if (i != k && j != k) matrix[i][j] += hold * matrix[k][j];
|
||||
if (i != k && j != k)
|
||||
matrix[i][j] += hold * matrix[k][j];
|
||||
}
|
||||
}
|
||||
|
||||
/** Divide row by pivot **/
|
||||
for (j = 0; j < 4; j++) {
|
||||
if (j != k) matrix[k][j] /= pvt_val;
|
||||
if (j != k)
|
||||
matrix[k][j] /= pvt_val;
|
||||
}
|
||||
|
||||
/** Replace pivot by reciprocal (at last we can touch it). **/
|
||||
|
|
|
|||
|
|
@ -113,10 +113,14 @@ public:
|
|||
real_t mub = (d_of(p1, q1, q2, q1) + mua * d_of(q2, q1, p2, p1)) / d_of(q2, q1, q2, q1);
|
||||
|
||||
// Clip the value between [0..1] constraining the solution to lie on the original curves.
|
||||
if (mua < 0) mua = 0;
|
||||
if (mub < 0) mub = 0;
|
||||
if (mua > 1) mua = 1;
|
||||
if (mub > 1) mub = 1;
|
||||
if (mua < 0)
|
||||
mua = 0;
|
||||
if (mub < 0)
|
||||
mub = 0;
|
||||
if (mua > 1)
|
||||
mua = 1;
|
||||
if (mub > 1)
|
||||
mub = 1;
|
||||
c1 = p1.lerp(p2, mua);
|
||||
c2 = q1.lerp(q2, mub);
|
||||
}
|
||||
|
|
@ -497,7 +501,8 @@ public:
|
|||
|
||||
bool orientation = an.cross(bn) > 0;
|
||||
|
||||
if ((bn.cross(cn) > 0) != orientation) return false;
|
||||
if ((bn.cross(cn) > 0) != orientation)
|
||||
return false;
|
||||
|
||||
return (cn.cross(an) > 0) == orientation;
|
||||
}
|
||||
|
|
@ -683,7 +688,8 @@ public:
|
|||
|
||||
// If the term we intend to square root is less than 0 then the answer won't be real,
|
||||
// so it definitely won't be t in the range 0 to 1.
|
||||
if (sqrtterm < 0) return -1;
|
||||
if (sqrtterm < 0)
|
||||
return -1;
|
||||
|
||||
// If we can assume that the line segment starts outside the circle (e.g. for continuous time collision detection)
|
||||
// then the following can be skipped and we can just return the equivalent of res1.
|
||||
|
|
@ -691,8 +697,10 @@ public:
|
|||
real_t res1 = (-b - sqrtterm) / (2 * a);
|
||||
real_t res2 = (-b + sqrtterm) / (2 * a);
|
||||
|
||||
if (res1 >= 0 && res1 <= 1) return res1;
|
||||
if (res2 >= 0 && res2 <= 1) return res2;
|
||||
if (res1 >= 0 && res1 <= 1)
|
||||
return res1;
|
||||
if (res2 >= 0 && res2 <= 1)
|
||||
return res2;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -233,12 +233,14 @@ public:
|
|||
static _ALWAYS_INLINE_ float range_lerp(float p_value, float p_istart, float p_istop, float p_ostart, float p_ostop) { return Math::lerp(p_ostart, p_ostop, Math::inverse_lerp(p_istart, p_istop, p_value)); }
|
||||
|
||||
static _ALWAYS_INLINE_ double smoothstep(double p_from, double p_to, double p_weight) {
|
||||
if (is_equal_approx(p_from, p_to)) return p_from;
|
||||
if (is_equal_approx(p_from, p_to))
|
||||
return p_from;
|
||||
double x = CLAMP((p_weight - p_from) / (p_to - p_from), 0.0, 1.0);
|
||||
return x * x * (3.0 - 2.0 * x);
|
||||
}
|
||||
static _ALWAYS_INLINE_ float smoothstep(float p_from, float p_to, float p_weight) {
|
||||
if (is_equal_approx(p_from, p_to)) return p_from;
|
||||
if (is_equal_approx(p_from, p_to))
|
||||
return p_from;
|
||||
float x = CLAMP((p_weight - p_from) / (p_to - p_from), 0.0f, 1.0f);
|
||||
return x * x * (3.0f - 2.0f * x);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,7 +206,8 @@ Quat Quat::slerpni(const Quat &q, const real_t &t) const {
|
|||
|
||||
real_t dot = from.dot(q);
|
||||
|
||||
if (Math::absf(dot) > 0.9999) return from;
|
||||
if (Math::absf(dot) > 0.9999)
|
||||
return from;
|
||||
|
||||
real_t theta = Math::acos(dot),
|
||||
sinT = 1.0 / Math::sin(theta),
|
||||
|
|
|
|||
|
|
@ -558,14 +558,16 @@ bool TriangleMesh::intersect_convex_shape(const Plane *p_planes, int p_plane_cou
|
|||
if (p.intersects_segment(point, next_point, &res)) {
|
||||
bool inisde = true;
|
||||
for (int k = 0; k < p_plane_count; k++) {
|
||||
if (k == i) continue;
|
||||
if (k == i)
|
||||
continue;
|
||||
const Plane &pp = p_planes[k];
|
||||
if (pp.is_point_over(res)) {
|
||||
inisde = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (inisde) return true;
|
||||
if (inisde)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (p.is_point_over(point)) {
|
||||
|
|
@ -573,7 +575,8 @@ bool TriangleMesh::intersect_convex_shape(const Plane *p_planes, int p_plane_cou
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (over) return true;
|
||||
if (over)
|
||||
return true;
|
||||
}
|
||||
|
||||
stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
|
||||
|
|
@ -652,7 +655,8 @@ bool TriangleMesh::inside_convex_shape(const Plane *p_planes, int p_plane_count,
|
|||
case TEST_AABB_BIT: {
|
||||
|
||||
bool intersects = scale.xform(b.aabb).intersects_convex_shape(p_planes, p_plane_count, p_points, p_point_count);
|
||||
if (!intersects) return false;
|
||||
if (!intersects)
|
||||
return false;
|
||||
|
||||
bool inside = scale.xform(b.aabb).inside_convex_shape(p_planes, p_plane_count);
|
||||
if (inside) {
|
||||
|
|
@ -667,7 +671,8 @@ bool TriangleMesh::inside_convex_shape(const Plane *p_planes, int p_plane_count,
|
|||
Vector3 point = scale.xform(vertexptr[s.indices[j]]);
|
||||
for (int i = 0; i < p_plane_count; i++) {
|
||||
const Plane &p = p_planes[i];
|
||||
if (p.is_point_over(point)) return false;
|
||||
if (p.is_point_over(point))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -103,13 +103,16 @@ bool Triangulate::snip(const Vector<Vector2> &p_contour, int u, int v, int w, in
|
|||
// To avoid that we allow zero-area triangles if all else failed.
|
||||
float threshold = relaxed ? -CMP_EPSILON : CMP_EPSILON;
|
||||
|
||||
if (threshold > (((Bx - Ax) * (Cy - Ay)) - ((By - Ay) * (Cx - Ax)))) return false;
|
||||
if (threshold > (((Bx - Ax) * (Cy - Ay)) - ((By - Ay) * (Cx - Ax))))
|
||||
return false;
|
||||
|
||||
for (p = 0; p < n; p++) {
|
||||
if ((p == u) || (p == v) || (p == w)) continue;
|
||||
if ((p == u) || (p == v) || (p == w))
|
||||
continue;
|
||||
Px = contour[V[p]].x;
|
||||
Py = contour[V[p]].y;
|
||||
if (is_inside_triangle(Ax, Ay, Bx, By, Cx, Cy, Px, Py, relaxed)) return false;
|
||||
if (is_inside_triangle(Ax, Ay, Bx, By, Cx, Cy, Px, Py, relaxed))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -119,7 +122,8 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour, Vector<int> &resul
|
|||
/* allocate and initialize list of Vertices in polygon */
|
||||
|
||||
int n = contour.size();
|
||||
if (n < 3) return false;
|
||||
if (n < 3)
|
||||
return false;
|
||||
|
||||
Vector<int> V;
|
||||
V.resize(n);
|
||||
|
|
@ -161,11 +165,14 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour, Vector<int> &resul
|
|||
|
||||
/* three consecutive vertices in current polygon, <u,v,w> */
|
||||
int u = v;
|
||||
if (nv <= u) u = 0; /* previous */
|
||||
if (nv <= u)
|
||||
u = 0; /* previous */
|
||||
v = u + 1;
|
||||
if (nv <= v) v = 0; /* new v */
|
||||
if (nv <= v)
|
||||
v = 0; /* new v */
|
||||
int w = v + 1;
|
||||
if (nv <= w) w = 0; /* next */
|
||||
if (nv <= w)
|
||||
w = 0; /* next */
|
||||
|
||||
if (snip(contour, u, v, w, nv, V, relaxed)) {
|
||||
int a, b, c, s, t;
|
||||
|
|
|
|||
|
|
@ -165,7 +165,8 @@ struct VariantObjectClassChecker<Control *> {
|
|||
#define CHECK_NOARG(m_arg) \
|
||||
{ \
|
||||
if (p_arg##m_arg.get_type() != Variant::NIL) { \
|
||||
if (r_argerror) *r_argerror = (m_arg - 1); \
|
||||
if (r_argerror) \
|
||||
*r_argerror = (m_arg - 1); \
|
||||
return CALL_ERROR_EXTRA_ARGUMENT; \
|
||||
} \
|
||||
}
|
||||
|
|
|
|||
|
|
@ -373,7 +373,8 @@ NodePath::NodePath(const String &p_path) {
|
|||
|
||||
String str = path.substr(from, i - from);
|
||||
if (str == "") {
|
||||
if (path[i] == 0) continue; // Allow end-of-path :
|
||||
if (path[i] == 0)
|
||||
continue; // Allow end-of-path :
|
||||
|
||||
ERR_FAIL_MSG("Invalid NodePath '" + p_path + "'.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -543,7 +543,8 @@ void Object::set_indexed(const Vector<StringName> &p_names, const Variant &p_val
|
|||
}
|
||||
|
||||
bool valid = false;
|
||||
if (!r_valid) r_valid = &valid;
|
||||
if (!r_valid)
|
||||
r_valid = &valid;
|
||||
|
||||
List<Variant> value_stack;
|
||||
|
||||
|
|
|
|||
|
|
@ -346,7 +346,8 @@ protected:
|
|||
return (bool (Object::*)(const StringName &, const Variant &)) & m_class::_set; \
|
||||
} \
|
||||
virtual bool _setv(const StringName &p_name, const Variant &p_property) { \
|
||||
if (m_inherits::_setv(p_name, p_property)) return true; \
|
||||
if (m_inherits::_setv(p_name, p_property)) \
|
||||
return true; \
|
||||
if (m_class::_get_set() != m_inherits::_get_set()) { \
|
||||
return _set(p_name, p_property); \
|
||||
} \
|
||||
|
|
|
|||
|
|
@ -145,7 +145,8 @@ struct DirAccessRef {
|
|||
DirAccess *f;
|
||||
DirAccessRef(DirAccess *fa) { f = fa; }
|
||||
~DirAccessRef() {
|
||||
if (f) memdelete(f);
|
||||
if (f)
|
||||
memdelete(f);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -192,7 +192,8 @@ struct FileAccessRef {
|
|||
operator FileAccess *() { return f; }
|
||||
FileAccessRef(FileAccess *fa) { f = fa; }
|
||||
~FileAccessRef() {
|
||||
if (f) memdelete(f);
|
||||
if (f)
|
||||
memdelete(f);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -130,9 +130,10 @@ void memdelete_allocator(T *p_class) {
|
|||
A::free(p_class);
|
||||
}
|
||||
|
||||
#define memdelete_notnull(m_v) \
|
||||
{ \
|
||||
if (m_v) memdelete(m_v); \
|
||||
#define memdelete_notnull(m_v) \
|
||||
{ \
|
||||
if (m_v) \
|
||||
memdelete(m_v); \
|
||||
}
|
||||
|
||||
#define memnew_arr(m_class, m_count) memnew_arr_template<m_class>(m_count)
|
||||
|
|
|
|||
|
|
@ -58,10 +58,12 @@ class RWLockRead {
|
|||
public:
|
||||
RWLockRead(const RWLock *p_lock) {
|
||||
lock = const_cast<RWLock *>(p_lock);
|
||||
if (lock) lock->read_lock();
|
||||
if (lock)
|
||||
lock->read_lock();
|
||||
}
|
||||
~RWLockRead() {
|
||||
if (lock) lock->read_unlock();
|
||||
if (lock)
|
||||
lock->read_unlock();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -72,10 +74,12 @@ class RWLockWrite {
|
|||
public:
|
||||
RWLockWrite(RWLock *p_lock) {
|
||||
lock = p_lock;
|
||||
if (lock) lock->write_lock();
|
||||
if (lock)
|
||||
lock->write_lock();
|
||||
}
|
||||
~RWLockWrite() {
|
||||
if (lock) lock->write_unlock();
|
||||
if (lock)
|
||||
lock->write_unlock();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -182,7 +182,8 @@ PoolAllocator::ID PoolAllocator::alloc(int p_size) {
|
|||
|
||||
ERR_FAIL_COND_V(p_size < 1, POOL_ALLOCATOR_INVALID_ID);
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (p_size > free_mem) OS::get_singleton()->debug_break();
|
||||
if (p_size > free_mem)
|
||||
OS::get_singleton()->debug_break();
|
||||
#endif
|
||||
ERR_FAIL_COND_V(p_size > free_mem, POOL_ALLOCATOR_INVALID_ID);
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,8 @@ private:
|
|||
public:
|
||||
_FORCE_INLINE_ bool in_list() const { return _root; }
|
||||
_FORCE_INLINE_ void remove_from_list() {
|
||||
if (_root) _root->remove(this);
|
||||
if (_root)
|
||||
_root->remove(this);
|
||||
}
|
||||
_FORCE_INLINE_ SelfList<T> *next() { return _next; }
|
||||
_FORCE_INLINE_ SelfList<T> *prev() { return _prev; }
|
||||
|
|
|
|||
|
|
@ -989,7 +989,8 @@ String TranslationServer::get_locale() const {
|
|||
|
||||
String TranslationServer::get_locale_name(const String &p_locale) const {
|
||||
|
||||
if (!locale_name_map.has(p_locale)) return String();
|
||||
if (!locale_name_map.has(p_locale))
|
||||
return String();
|
||||
return locale_name_map[p_locale];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1882,7 +1882,8 @@ bool String::is_numeric() const {
|
|||
};
|
||||
|
||||
int s = 0;
|
||||
if (operator[](0) == '-') ++s;
|
||||
if (operator[](0) == '-')
|
||||
++s;
|
||||
bool dot = false;
|
||||
for (int i = s; i < length(); i++) {
|
||||
|
||||
|
|
|
|||
|
|
@ -474,7 +474,8 @@ public:
|
|||
type = NIL;
|
||||
}
|
||||
_FORCE_INLINE_ ~Variant() {
|
||||
if (type != Variant::NIL) clear();
|
||||
if (type != Variant::NIL)
|
||||
clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -181,21 +181,26 @@ bool Variant::booleanize() const {
|
|||
return; \
|
||||
}
|
||||
|
||||
#define DEFAULT_OP_NUM(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); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
#define DEFAULT_OP_NUM(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); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
};
|
||||
|
||||
#define DEFAULT_OP_NUM_NULL(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 == NIL) _RETURN(!(p_b.type m_op NIL)); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
#define DEFAULT_OP_NUM_NULL(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 == NIL) \
|
||||
_RETURN(!(p_b.type m_op NIL)); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
};
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
|
@ -219,12 +224,14 @@ bool Variant::booleanize() const {
|
|||
_RETURN_FAIL \
|
||||
};
|
||||
#else
|
||||
#define DEFAULT_OP_NUM_DIV(m_prefix, m_op_name, m_name, m_type) \
|
||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||
if (p_b.type == INT) _RETURN(p_a._data.m_type / p_b._data._int); \
|
||||
if (p_b.type == FLOAT) _RETURN(p_a._data.m_type / p_b._data._float); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
#define DEFAULT_OP_NUM_DIV(m_prefix, m_op_name, m_name, m_type) \
|
||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||
if (p_b.type == INT) \
|
||||
_RETURN(p_a._data.m_type / p_b._data._int); \
|
||||
if (p_b.type == FLOAT) \
|
||||
_RETURN(p_a._data.m_type / p_b._data._float); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
@ -238,62 +245,84 @@ 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 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_STR_REV(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||
if (p_b.type == STRING) _RETURN(*reinterpret_cast<const m_type *>(p_b._data._mem) m_op *reinterpret_cast<const String *>(p_a._data._mem)); \
|
||||
if (p_b.type == STRING_NAME) _RETURN(*reinterpret_cast<const m_type *>(p_b._data._mem) m_op *reinterpret_cast<const StringName *>(p_a._data._mem)); \
|
||||
if (p_b.type == NODE_PATH) _RETURN(*reinterpret_cast<const m_type *>(p_b._data._mem) m_op *reinterpret_cast<const NodePath *>(p_a._data._mem)); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
#define DEFAULT_OP_STR_REV(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||
if (p_b.type == STRING) \
|
||||
_RETURN(*reinterpret_cast<const m_type *>(p_b._data._mem) m_op *reinterpret_cast<const String *>(p_a._data._mem)); \
|
||||
if (p_b.type == STRING_NAME) \
|
||||
_RETURN(*reinterpret_cast<const m_type *>(p_b._data._mem) m_op *reinterpret_cast<const StringName *>(p_a._data._mem)); \
|
||||
if (p_b.type == NODE_PATH) \
|
||||
_RETURN(*reinterpret_cast<const m_type *>(p_b._data._mem) m_op *reinterpret_cast<const NodePath *>(p_a._data._mem)); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
};
|
||||
|
||||
#define DEFAULT_OP_STR(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||
if (p_b.type == STRING) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
|
||||
if (p_b.type == STRING_NAME) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const StringName *>(p_b._data._mem)); \
|
||||
if (p_b.type == NODE_PATH) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const NodePath *>(p_b._data._mem)); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
#define DEFAULT_OP_STR(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||
if (p_b.type == STRING) \
|
||||
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
|
||||
if (p_b.type == STRING_NAME) \
|
||||
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const StringName *>(p_b._data._mem)); \
|
||||
if (p_b.type == NODE_PATH) \
|
||||
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const NodePath *>(p_b._data._mem)); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
};
|
||||
|
||||
#define DEFAULT_OP_STR_NULL(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||
if (p_b.type == STRING) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
|
||||
if (p_b.type == STRING_NAME) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const StringName *>(p_b._data._mem)); \
|
||||
if (p_b.type == NODE_PATH) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const NodePath *>(p_b._data._mem)); \
|
||||
if (p_b.type == NIL) _RETURN(!(p_b.type m_op NIL)); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
#define DEFAULT_OP_STR_NULL(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||
if (p_b.type == STRING) \
|
||||
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
|
||||
if (p_b.type == STRING_NAME) \
|
||||
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const StringName *>(p_b._data._mem)); \
|
||||
if (p_b.type == NODE_PATH) \
|
||||
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const NodePath *>(p_b._data._mem)); \
|
||||
if (p_b.type == NIL) \
|
||||
_RETURN(!(p_b.type m_op NIL)); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
};
|
||||
|
||||
#define DEFAULT_OP_STR_NULL_NP(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||
if (p_b.type == STRING) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
|
||||
if (p_b.type == NODE_PATH) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const NodePath *>(p_b._data._mem)); \
|
||||
if (p_b.type == NIL) _RETURN(!(p_b.type m_op NIL)); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
#define DEFAULT_OP_STR_NULL_NP(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||
if (p_b.type == STRING) \
|
||||
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
|
||||
if (p_b.type == NODE_PATH) \
|
||||
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const NodePath *>(p_b._data._mem)); \
|
||||
if (p_b.type == NIL) \
|
||||
_RETURN(!(p_b.type m_op NIL)); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
};
|
||||
|
||||
#define DEFAULT_OP_STR_NULL_SN(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||
if (p_b.type == STRING) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
|
||||
if (p_b.type == STRING_NAME) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const StringName *>(p_b._data._mem)); \
|
||||
if (p_b.type == NIL) _RETURN(!(p_b.type m_op NIL)); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
#define DEFAULT_OP_STR_NULL_SN(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||
if (p_b.type == STRING) \
|
||||
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
|
||||
if (p_b.type == STRING_NAME) \
|
||||
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const StringName *>(p_b._data._mem)); \
|
||||
if (p_b.type == NIL) \
|
||||
_RETURN(!(p_b.type m_op NIL)); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
};
|
||||
|
||||
#define DEFAULT_OP_LOCALMEM_REV(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||
|
|
@ -332,13 +361,16 @@ bool Variant::booleanize() const {
|
|||
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem)); \
|
||||
}
|
||||
|
||||
#define DEFAULT_OP_LOCALMEM_NUM(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||
if (p_b.type == m_name) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const m_type *>(p_b._data._mem)); \
|
||||
if (p_b.type == INT) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op p_b._data._int); \
|
||||
if (p_b.type == FLOAT) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op p_b._data._float); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
#define DEFAULT_OP_LOCALMEM_NUM(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||
if (p_b.type == m_name) \
|
||||
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const m_type *>(p_b._data._mem)); \
|
||||
if (p_b.type == INT) \
|
||||
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op p_b._data._int); \
|
||||
if (p_b.type == FLOAT) \
|
||||
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op p_b._data._float); \
|
||||
\
|
||||
_RETURN_FAIL \
|
||||
}
|
||||
|
||||
#define DEFAULT_OP_PTR(m_op, m_name, m_sub) \
|
||||
|
|
@ -436,7 +468,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
|||
SWITCH(math, p_op, p_a.type) {
|
||||
SWITCH_OP(math, OP_EQUAL, p_a.type) {
|
||||
CASE_TYPE(math, OP_EQUAL, NIL) {
|
||||
if (p_b.type == NIL) _RETURN(true);
|
||||
if (p_b.type == NIL)
|
||||
_RETURN(true);
|
||||
if (p_b.type == OBJECT)
|
||||
_RETURN(p_b._get_obj().obj == nullptr);
|
||||
|
||||
|
|
@ -532,7 +565,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
|||
|
||||
SWITCH_OP(math, OP_NOT_EQUAL, p_a.type) {
|
||||
CASE_TYPE(math, OP_NOT_EQUAL, NIL) {
|
||||
if (p_b.type == NIL) _RETURN(false);
|
||||
if (p_b.type == NIL)
|
||||
_RETURN(false);
|
||||
if (p_b.type == OBJECT)
|
||||
_RETURN(p_b._get_obj().obj != nullptr);
|
||||
|
||||
|
|
@ -1983,7 +2017,8 @@ Variant Variant::get_named(const StringName &p_index, bool *r_valid) const {
|
|||
|
||||
#define DEFAULT_OP_DVECTOR_SET(m_name, m_type, skip_cond) \
|
||||
case m_name: { \
|
||||
if (skip_cond) return; \
|
||||
if (skip_cond) \
|
||||
return; \
|
||||
\
|
||||
if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) { \
|
||||
int index = p_index; \
|
||||
|
|
|
|||
|
|
@ -69,7 +69,8 @@ public:
|
|||
void remove(int p_index) { _cowdata.remove(p_index); }
|
||||
void erase(const T &p_val) {
|
||||
int idx = find(p_val);
|
||||
if (idx >= 0) remove(idx);
|
||||
if (idx >= 0)
|
||||
remove(idx);
|
||||
}
|
||||
void invert();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue