summaryrefslogtreecommitdiffstats
path: root/servers
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-04-22 12:00:34 +0200
committerGitHub <noreply@github.com>2019-04-22 12:00:34 +0200
commita342131eba2834240289112a1b8d5d0c68a265c9 (patch)
treec412df9c24c8b568086ea6ff72a097fb8d20dbc0 /servers
parent1e67f214c520b2c1a9fed30f78440c4e1d4d14dd (diff)
parent856a8226a5306632f5dd4d9e9c916d89e3e21495 (diff)
downloadredot-engine-a342131eba2834240289112a1b8d5d0c68a265c9.tar.gz
Merge pull request #27673 from qarmin/small_fixes
Small fixes, mostly duplicated code
Diffstat (limited to 'servers')
-rw-r--r--servers/audio/audio_rb_resampler.cpp6
-rw-r--r--servers/audio/effects/audio_effect_record.cpp2
-rw-r--r--servers/physics/space_sw.cpp6
-rw-r--r--servers/physics_2d/shape_2d_sw.cpp2
-rw-r--r--servers/physics_2d/space_2d_sw.cpp8
-rw-r--r--servers/visual/visual_server_scene.cpp4
6 files changed, 11 insertions, 17 deletions
diff --git a/servers/audio/audio_rb_resampler.cpp b/servers/audio/audio_rb_resampler.cpp
index 88f3ed8d15..ad5bcde382 100644
--- a/servers/audio/audio_rb_resampler.cpp
+++ b/servers/audio/audio_rb_resampler.cpp
@@ -201,10 +201,8 @@ void AudioRBResampler::clear() {
return;
//should be stopped at this point but just in case
- if (rb) {
- memdelete_arr(rb);
- memdelete_arr(read_buf);
- }
+ memdelete_arr(rb);
+ memdelete_arr(read_buf);
rb = NULL;
offset = 0;
rb_read_pos = 0;
diff --git a/servers/audio/effects/audio_effect_record.cpp b/servers/audio/effects/audio_effect_record.cpp
index 2dd71f9452..96d5c9df89 100644
--- a/servers/audio/effects/audio_effect_record.cpp
+++ b/servers/audio/effects/audio_effect_record.cpp
@@ -66,7 +66,7 @@ void AudioEffectRecordInstance::_io_thread_process() {
while (is_recording) {
//Check: The current recording has been requested to stop
- if (is_recording && !base->recording_active) {
+ if (!base->recording_active) {
is_recording = false;
}
diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp
index 4ab92715f4..e52cc376c0 100644
--- a/servers/physics/space_sw.cpp
+++ b/servers/physics/space_sw.cpp
@@ -351,10 +351,8 @@ bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform &p_sh
CollisionSolverSW::CallbackResult cbkres = NULL;
PhysicsServerSW::CollCbkData *cbkptr = NULL;
- if (p_result_max > 0) {
- cbkptr = &cbk;
- cbkres = PhysicsServerSW::_shape_col_cbk;
- }
+ cbkptr = &cbk;
+ cbkres = PhysicsServerSW::_shape_col_cbk;
for (int i = 0; i < amount; i++) {
diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp
index 56b87f620c..66d2dcd417 100644
--- a/servers/physics_2d/shape_2d_sw.cpp
+++ b/servers/physics_2d/shape_2d_sw.cpp
@@ -586,7 +586,7 @@ bool ConvexPolygonShape2DSW::contains_point(const Vector2 &p_point) const {
in = true;
}
- return (in && !out) || (!in && out);
+ return in != out;
}
bool ConvexPolygonShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const {
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index 831764b40c..f5acadd71c 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -333,10 +333,8 @@ bool Physics2DDirectSpaceStateSW::collide_shape(RID p_shape, const Transform2D &
CollisionSolver2DSW::CallbackResult cbkres = NULL;
Physics2DServerSW::CollCbkData *cbkptr = NULL;
- if (p_result_max > 0) {
- cbkptr = &cbk;
- cbkres = Physics2DServerSW::_shape_col_cbk;
- }
+ cbkptr = &cbk;
+ cbkres = Physics2DServerSW::_shape_col_cbk;
for (int i = 0; i < amount; i++) {
@@ -353,7 +351,7 @@ bool Physics2DDirectSpaceStateSW::collide_shape(RID p_shape, const Transform2D &
cbk.valid_depth = 0;
if (CollisionSolver2DSW::solve(shape, p_shape_xform, p_motion, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), Vector2(), cbkres, cbkptr, NULL, p_margin)) {
- collided = p_result_max == 0 || cbk.amount > 0;
+ collided = cbk.amount > 0;
}
}
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index a5858ab661..4ee2824018 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -1871,7 +1871,7 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
//failure
} else if (ins->base_type == VS::INSTANCE_LIGHT && ins->visible) {
- if (ins->visible && light_cull_count < MAX_LIGHTS_CULLED) {
+ if (light_cull_count < MAX_LIGHTS_CULLED) {
InstanceLightData *light = static_cast<InstanceLightData *>(ins->base_data);
@@ -1888,7 +1888,7 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
}
} else if (ins->base_type == VS::INSTANCE_REFLECTION_PROBE && ins->visible) {
- if (ins->visible && reflection_probe_cull_count < MAX_REFLECTION_PROBES_CULLED) {
+ if (reflection_probe_cull_count < MAX_REFLECTION_PROBES_CULLED) {
InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(ins->base_data);