1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-15 13:51:40 +00:00

Style: Enforce braces around if blocks and loops

Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
This commit is contained in:
Rémi Verschelde
2021-05-05 12:44:11 +02:00
parent b8d198eeed
commit 140350d767
694 changed files with 23283 additions and 12499 deletions

View File

@@ -146,10 +146,11 @@ RID PhysicsServerSW::space_create() {
void PhysicsServerSW::space_set_active(RID p_space, bool p_active) {
SpaceSW *space = space_owner.get(p_space);
ERR_FAIL_COND(!space);
if (p_active)
if (p_active) {
active_spaces.insert(space);
else
} else {
active_spaces.erase(space);
}
}
bool PhysicsServerSW::space_is_active(RID p_space) const {
@@ -215,8 +216,9 @@ void PhysicsServerSW::area_set_space(RID p_area, RID p_space) {
ERR_FAIL_COND(!space);
}
if (area->get_space() == space)
if (area->get_space() == space) {
return; //pointless
}
area->clear_constraints();
area->set_space(space);
@@ -227,8 +229,9 @@ RID PhysicsServerSW::area_get_space(RID p_area) const {
ERR_FAIL_COND_V(!area, RID());
SpaceSW *space = area->get_space();
if (!space)
if (!space) {
return RID();
}
return space->get_self();
};
@@ -307,8 +310,9 @@ void PhysicsServerSW::area_clear_shapes(RID p_area) {
AreaSW *area = area_owner.get(p_area);
ERR_FAIL_COND(!area);
while (area->get_shape_count())
while (area->get_shape_count()) {
area->remove_shape(0);
}
}
void PhysicsServerSW::area_set_shape_disabled(RID p_area, int p_shape_idx, bool p_disabled) {
@@ -426,10 +430,12 @@ void PhysicsServerSW::area_set_area_monitor_callback(RID p_area, Object *p_recei
RID PhysicsServerSW::body_create(BodyMode p_mode, bool p_init_sleeping) {
BodySW *body = memnew(BodySW);
if (p_mode != BODY_MODE_RIGID)
if (p_mode != BODY_MODE_RIGID) {
body->set_mode(p_mode);
if (p_init_sleeping)
}
if (p_init_sleeping) {
body->set_state(BODY_STATE_SLEEPING, p_init_sleeping);
}
RID rid = body_owner.make_rid(body);
body->set_self(rid);
return rid;
@@ -445,8 +451,9 @@ void PhysicsServerSW::body_set_space(RID p_body, RID p_space) {
ERR_FAIL_COND(!space);
}
if (body->get_space() == space)
if (body->get_space() == space) {
return; //pointless
}
body->clear_constraint_map();
body->set_space(space);
@@ -457,8 +464,9 @@ RID PhysicsServerSW::body_get_space(RID p_body) const {
ERR_FAIL_COND_V(!body, RID());
SpaceSW *space = body->get_space();
if (!space)
if (!space) {
return RID();
}
return space->get_self();
};
@@ -546,8 +554,9 @@ void PhysicsServerSW::body_clear_shapes(RID p_body) {
BodySW *body = body_owner.get(p_body);
ERR_FAIL_COND(!body);
while (body->get_shape_count())
while (body->get_shape_count()) {
body->remove_shape(0);
}
}
void PhysicsServerSW::body_set_enable_continuous_collision_detection(RID p_body, bool p_enable) {
@@ -1275,8 +1284,9 @@ void PhysicsServerSW::init() {
void PhysicsServerSW::step(real_t p_step) {
#ifndef _3D_DISABLED
if (!active)
if (!active) {
return;
}
_update_shapes();
@@ -1298,8 +1308,9 @@ void PhysicsServerSW::step(real_t p_step) {
void PhysicsServerSW::flush_queries() {
#ifndef _3D_DISABLED
if (!active)
if (!active) {
return;
}
flushing_queries = true;
@@ -1377,8 +1388,9 @@ void PhysicsServerSW::_update_shapes() {
void PhysicsServerSW::_shape_col_cbk(const Vector3 &p_point_A, const Vector3 &p_point_B, void *p_userdata) {
CollCbkData *cbk = (CollCbkData *)p_userdata;
if (cbk->max == 0)
if (cbk->max == 0) {
return;
}
if (cbk->amount == cbk->max) {
//find least deep
@@ -1393,8 +1405,9 @@ void PhysicsServerSW::_shape_col_cbk(const Vector3 &p_point_A, const Vector3 &p_
}
real_t d = p_point_A.distance_squared_to(p_point_B);
if (d < min_depth)
if (d < min_depth) {
return;
}
cbk->ptr[min_depth_idx * 2 + 0] = p_point_A;
cbk->ptr[min_depth_idx * 2 + 1] = p_point_B;