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:
@@ -145,8 +145,9 @@ real_t PhysicsServer2DSW::shape_get_custom_solver_bias(RID p_shape) const {
|
||||
void PhysicsServer2DSW::_shape_col_cbk(const Vector2 &p_point_A, const Vector2 &p_point_B, void *p_userdata) {
|
||||
CollCbkData *cbk = (CollCbkData *)p_userdata;
|
||||
|
||||
if (cbk->max == 0)
|
||||
if (cbk->max == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cbk->valid_dir != Vector2()) {
|
||||
if (p_point_A.distance_squared_to(p_point_B) > cbk->valid_depth * cbk->valid_depth) {
|
||||
@@ -182,8 +183,9 @@ void PhysicsServer2DSW::_shape_col_cbk(const Vector2 &p_point_A, const Vector2 &
|
||||
}
|
||||
|
||||
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;
|
||||
cbk->passed++;
|
||||
@@ -234,10 +236,11 @@ RID PhysicsServer2DSW::space_create() {
|
||||
void PhysicsServer2DSW::space_set_active(RID p_space, bool p_active) {
|
||||
Space2DSW *space = space_owner.getornull(p_space);
|
||||
ERR_FAIL_COND(!space);
|
||||
if (p_active)
|
||||
if (p_active) {
|
||||
active_spaces.insert(space);
|
||||
else
|
||||
} else {
|
||||
active_spaces.erase(space);
|
||||
}
|
||||
}
|
||||
|
||||
bool PhysicsServer2DSW::space_is_active(RID p_space) const {
|
||||
@@ -303,8 +306,9 @@ void PhysicsServer2DSW::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);
|
||||
@@ -315,8 +319,9 @@ RID PhysicsServer2DSW::area_get_space(RID p_area) const {
|
||||
ERR_FAIL_COND_V(!area, RID());
|
||||
|
||||
Space2DSW *space = area->get_space();
|
||||
if (!space)
|
||||
if (!space) {
|
||||
return RID();
|
||||
}
|
||||
return space->get_self();
|
||||
};
|
||||
|
||||
@@ -406,8 +411,9 @@ void PhysicsServer2DSW::area_clear_shapes(RID p_area) {
|
||||
Area2DSW *area = area_owner.getornull(p_area);
|
||||
ERR_FAIL_COND(!area);
|
||||
|
||||
while (area->get_shape_count())
|
||||
while (area->get_shape_count()) {
|
||||
area->remove_shape(0);
|
||||
}
|
||||
}
|
||||
|
||||
void PhysicsServer2DSW::area_attach_object_instance_id(RID p_area, ObjectID p_id) {
|
||||
@@ -544,8 +550,9 @@ void PhysicsServer2DSW::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);
|
||||
@@ -556,8 +563,9 @@ RID PhysicsServer2DSW::body_get_space(RID p_body) const {
|
||||
ERR_FAIL_COND_V(!body, RID());
|
||||
|
||||
Space2DSW *space = body->get_space();
|
||||
if (!space)
|
||||
if (!space) {
|
||||
return RID();
|
||||
}
|
||||
return space->get_self();
|
||||
};
|
||||
|
||||
@@ -651,8 +659,9 @@ void PhysicsServer2DSW::body_clear_shapes(RID p_body) {
|
||||
Body2DSW *body = body_owner.getornull(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
||||
while (body->get_shape_count())
|
||||
while (body->get_shape_count()) {
|
||||
body->remove_shape(0);
|
||||
}
|
||||
}
|
||||
|
||||
void PhysicsServer2DSW::body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled) {
|
||||
@@ -966,8 +975,9 @@ int PhysicsServer2DSW::body_test_ray_separation(RID p_body, const Transform2D &p
|
||||
PhysicsDirectBodyState2D *PhysicsServer2DSW::body_get_direct_state(RID p_body) {
|
||||
ERR_FAIL_COND_V_MSG((using_threads && !doing_sync), nullptr, "Body state is inaccessible right now, wait for iteration or physics process notification.");
|
||||
|
||||
if (!body_owner.owns(p_body))
|
||||
if (!body_owner.owns(p_body)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Body2DSW *body = body_owner.getornull(p_body);
|
||||
ERR_FAIL_COND_V(!body, nullptr);
|
||||
@@ -1213,8 +1223,9 @@ void PhysicsServer2DSW::init() {
|
||||
};
|
||||
|
||||
void PhysicsServer2DSW::step(real_t p_step) {
|
||||
if (!active)
|
||||
if (!active) {
|
||||
return;
|
||||
}
|
||||
|
||||
_update_shapes();
|
||||
|
||||
@@ -1238,8 +1249,9 @@ void PhysicsServer2DSW::sync() {
|
||||
};
|
||||
|
||||
void PhysicsServer2DSW::flush_queries() {
|
||||
if (!active)
|
||||
if (!active) {
|
||||
return;
|
||||
}
|
||||
|
||||
flushing_queries = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user