diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2018-10-06 16:20:41 -0400 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2018-10-06 16:20:41 -0400 |
commit | 4f7b33cdcfdcbc11bcc506018dff1b06db3cf3f6 (patch) | |
tree | 688f040a857c59629101076487c097da6bc5dff3 /servers | |
parent | 37386f112bafa9c4e94c342f6d5f04392a5623f7 (diff) |
Remove redundant "== false" code
Some of this code has been re-organized.
f
Diffstat (limited to 'servers')
-rw-r--r-- | servers/physics/joints/generic_6dof_joint_sw.cpp | 2 | ||||
-rw-r--r-- | servers/physics/joints/generic_6dof_joint_sw.h | 6 | ||||
-rw-r--r-- | servers/physics_2d/body_pair_2d_sw.cpp | 2 | ||||
-rw-r--r-- | servers/visual/visual_server_scene.cpp | 10 | ||||
-rw-r--r-- | servers/visual/visual_server_scene.h | 5 |
5 files changed, 14 insertions, 11 deletions
diff --git a/servers/physics/joints/generic_6dof_joint_sw.cpp b/servers/physics/joints/generic_6dof_joint_sw.cpp index 9b1a41e80d..60505c08c5 100644 --- a/servers/physics/joints/generic_6dof_joint_sw.cpp +++ b/servers/physics/joints/generic_6dof_joint_sw.cpp @@ -83,7 +83,7 @@ int G6DOFRotationalLimitMotorSW::testLimitValue(real_t test_value) { real_t G6DOFRotationalLimitMotorSW::solveAngularLimits( real_t timeStep, Vector3 &axis, real_t jacDiagABInv, BodySW *body0, BodySW *body1) { - if (needApplyTorques() == false) return 0.0f; + if (!needApplyTorques()) return 0.0f; real_t target_velocity = m_targetVelocity; real_t maxMotorForce = m_maxMotorForce; diff --git a/servers/physics/joints/generic_6dof_joint_sw.h b/servers/physics/joints/generic_6dof_joint_sw.h index b350546c5d..035525c9e6 100644 --- a/servers/physics/joints/generic_6dof_joint_sw.h +++ b/servers/physics/joints/generic_6dof_joint_sw.h @@ -118,14 +118,12 @@ public: //! Is limited bool isLimited() { - if (m_loLimit >= m_hiLimit) return false; - return true; + return (m_loLimit < m_hiLimit); } //! Need apply correction bool needApplyTorques() { - if (m_currentLimit == 0 && m_enableMotor == false) return false; - return true; + return (m_enableMotor || m_currentLimit != 0); } //! calculates error diff --git a/servers/physics_2d/body_pair_2d_sw.cpp b/servers/physics_2d/body_pair_2d_sw.cpp index 2633edf7bb..93a05b74ef 100644 --- a/servers/physics_2d/body_pair_2d_sw.cpp +++ b/servers/physics_2d/body_pair_2d_sw.cpp @@ -138,7 +138,7 @@ void BodyPair2DSW::_validate_contacts() { Contact &c = contacts[i]; bool erase = false; - if (c.reused == false) { + if (!c.reused) { //was left behind in previous frame erase = true; } else { diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index cd0702d20b..654994b83f 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -2831,7 +2831,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { RID rid = E->key(); const InstanceGIProbeData::LightCache &lc = E->get(); - if ((!probe_data->dynamic.light_cache_changes.has(rid) || !(probe_data->dynamic.light_cache_changes[rid] == lc)) && lc.visible) { + if ((!probe_data->dynamic.light_cache_changes.has(rid) || probe_data->dynamic.light_cache_changes[rid] != lc) && lc.visible) { //erase light data _bake_gi_probe_light(header, cells, local_data, leaves, leaf_count, lc, -1); @@ -2844,7 +2844,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { RID rid = E->key(); const InstanceGIProbeData::LightCache &lc = E->get(); - if ((!probe_data->dynamic.light_cache.has(rid) || !(probe_data->dynamic.light_cache[rid] == lc)) && lc.visible) { + if ((!probe_data->dynamic.light_cache.has(rid) || probe_data->dynamic.light_cache[rid] != lc) && lc.visible) { //add light data _bake_gi_probe_light(header, cells, local_data, leaves, leaf_count, lc, 1); @@ -3061,7 +3061,7 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) { lc.transform = probe_data->dynamic.light_to_cell_xform * E->get()->transform; lc.visible = E->get()->visible; - if (!probe_data->dynamic.light_cache.has(E->get()->self) || !(probe_data->dynamic.light_cache[E->get()->self] == lc)) { + if (!probe_data->dynamic.light_cache.has(E->get()->self) || probe_data->dynamic.light_cache[E->get()->self] != lc) { all_equal = false; } @@ -3081,7 +3081,7 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) { lc.transform = probe_data->dynamic.light_to_cell_xform * E->get()->transform; lc.visible = E->get()->visible; - if (!probe_data->dynamic.light_cache.has(E->get()->self) || !(probe_data->dynamic.light_cache[E->get()->self] == lc)) { + if (!probe_data->dynamic.light_cache.has(E->get()->self) || probe_data->dynamic.light_cache[E->get()->self] != lc) { all_equal = false; } @@ -3164,7 +3164,7 @@ void VisualServerScene::render_probes() { force_lighting = true; } - if (probe->invalid == false && probe->dynamic.enabled) { + if (!probe->invalid && probe->dynamic.enabled) { switch (probe->dynamic.updating_stage) { case GI_UPDATE_STAGE_CHECK: { diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index bcd6d1d972..0d4737f268 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -355,6 +355,11 @@ public: visible == p_cache.visible); } + bool operator!=(const LightCache &p_cache) { + + return !operator==(p_cache); + } + LightCache() { type = VS::LIGHT_DIRECTIONAL; |