diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp index de312888385..f1c74779746 100644 --- a/drivers/gles2/rasterizer_scene_gles2.cpp +++ b/drivers/gles2/rasterizer_scene_gles2.cpp @@ -480,7 +480,6 @@ RID RasterizerSceneGLES2::reflection_probe_instance_create(RID p_probe) { rpi->current_resolution = 0; rpi->dirty = true; - rpi->last_pass = 0; rpi->index = 0; for (int i = 0; i < 6; i++) { diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index df8bd9feb05..4d1848285a4 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1061,12 +1061,11 @@ void RasterizerSceneGLES3::gi_probe_instance_set_light_data(RID p_probe, RID p_b if (p_data.is_valid()) { RasterizerStorageGLES3::GIProbeData *gipd = storage->gi_probe_data_owner.getornull(p_data); ERR_FAIL_COND(!gipd); - if (gipd) { - gipi->tex_cache = gipd->tex_id; - gipi->cell_size_cache.x = 1.0 / gipd->width; - gipi->cell_size_cache.y = 1.0 / gipd->height; - gipi->cell_size_cache.z = 1.0 / gipd->depth; - } + + gipi->tex_cache = gipd->tex_id; + gipi->cell_size_cache.x = 1.0 / gipd->width; + gipi->cell_size_cache.y = 1.0 / gipd->height; + gipi->cell_size_cache.z = 1.0 / gipd->depth; } } void RasterizerSceneGLES3::gi_probe_instance_set_transform_to_data(RID p_probe, const Transform &p_xform) { diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp index 94e6d4ded09..b630324c623 100644 --- a/editor/collada/collada.cpp +++ b/editor/collada/collada.cpp @@ -2255,8 +2255,7 @@ void Collada::_merge_skeletons2(VisualScene *p_vscene) { Node *node = state.scene_map[name]; ERR_CONTINUE(node->type != Node::TYPE_JOINT); - if (node->type != Node::TYPE_JOINT) - continue; + NodeSkeleton *sk = NULL; while (node && !sk) { diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index 44eaf3d9ef6..e152827c632 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -1614,8 +1614,6 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones continue; } - ERR_CONTINUE(xform_idx == -1); - Vector data = at.get_value_at_time(snapshots[i]); ERR_CONTINUE(data.empty()); diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index d711c1717d5..8a2393ff608 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -130,8 +130,7 @@ void InspectorDock::_menu_option(int p_option) { ERR_FAIL_INDEX(idx, methods.size()); String name = methods[idx].name; - if (current) - current->call(name); + current->call(name); } } } diff --git a/editor/plugins/animation_tree_player_editor_plugin.cpp b/editor/plugins/animation_tree_player_editor_plugin.cpp index e2a44069d99..e977c5b9086 100644 --- a/editor/plugins/animation_tree_player_editor_plugin.cpp +++ b/editor/plugins/animation_tree_player_editor_plugin.cpp @@ -835,7 +835,7 @@ void AnimationTreePlayerEditor::_gui_input(Ref p_event) { click_motion = Point2(mm->get_position().x, mm->get_position().y); update(); } - if ((mm->get_button_mask() & 4 || Input::get_singleton()->is_key_pressed(KEY_SPACE))) { + if (mm->get_button_mask() & 4 || Input::get_singleton()->is_key_pressed(KEY_SPACE)) { h_scroll->set_value(h_scroll->get_value() - mm->get_relative().x); v_scroll->set_value(v_scroll->get_value() - mm->get_relative().y); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 37ae2d146c0..29fa7a75e2b 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1847,7 +1847,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref &p_event) { } // Confirm the move (only if it was moved) - if (b.is_valid() && !b->is_pressed() && b->get_button_index() == BUTTON_LEFT && (drag_type == DRAG_MOVE)) { + if (b.is_valid() && !b->is_pressed() && b->get_button_index() == BUTTON_LEFT) { if (transform.affine_inverse().xform(b->get_position()) != drag_from) { _commit_canvas_item_state(drag_selection, TTR("Move CanvasItem"), true); } diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 7e4861cd094..fd8720e2c8c 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -811,10 +811,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { List::Element *e = selection.front(); if (e) { Node *node = e->get(); - if (node) { - if (node && node->get_scene_inherited_state().is_valid()) { - scene_tree->emit_signal("open", node->get_scene_inherited_state()->get_path()); - } + if (node && node->get_scene_inherited_state().is_valid()) { + scene_tree->emit_signal("open", node->get_scene_inherited_state()->get_path()); } } } break; diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 2e06a903aa2..6f379197371 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -324,7 +324,6 @@ void EditorSpatialGizmo::add_handles(const Vector &p_handles, const Ref ERR_FAIL_COND(!spatial_node); - ERR_FAIL_COND(!spatial_node); Instance ins; Ref mesh = memnew(ArrayMesh); diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.cpp b/modules/gdnative/videodecoder/video_stream_gdnative.cpp index 8fcebe7855e..9bb11862699 100644 --- a/modules/gdnative/videodecoder/video_stream_gdnative.cpp +++ b/modules/gdnative/videodecoder/video_stream_gdnative.cpp @@ -61,8 +61,8 @@ int64_t GDAPI godot_videodecoder_file_seek(void *ptr, int64_t pos, int whence) { // file FileAccess *file = reinterpret_cast(ptr); - size_t len = file->get_len(); if (file) { + size_t len = file->get_len(); switch (whence) { case SEEK_SET: { // Just for explicitness diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index fafc73b7e61..80c06ea6c34 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -2997,8 +2997,8 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co } } } + base_type = base_type.class_type->base_type; } - base_type = base_type.class_type->base_type; } break; case GDScriptParser::DataType::SCRIPT: case GDScriptParser::DataType::GDSCRIPT: { diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp index 8962e3bb340..97acb6f7f3f 100644 --- a/modules/gdscript/gdscript_tokenizer.cpp +++ b/modules/gdscript/gdscript_tokenizer.cpp @@ -894,7 +894,7 @@ void GDScriptTokenizerText::_advance() { } hexa_found = true; } else if (!hexa_found && GETCHAR(i) == 'e') { - if (hexa_found || exponent_found) { + if (exponent_found) { _make_error("Invalid numeric constant at 'e'"); return; } diff --git a/modules/recast/navigation_mesh_editor_plugin.cpp b/modules/recast/navigation_mesh_editor_plugin.cpp index a068f3b0f97..62108620bd8 100644 --- a/modules/recast/navigation_mesh_editor_plugin.cpp +++ b/modules/recast/navigation_mesh_editor_plugin.cpp @@ -67,9 +67,7 @@ void NavigationMeshEditor::_bake_pressed() { NavigationMeshGenerator::clear(node->get_navigation_mesh()); NavigationMeshGenerator::bake(node->get_navigation_mesh(), node); - if (node) { - node->update_gizmo(); - } + node->update_gizmo(); } void NavigationMeshEditor::_clear_pressed() { diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index e489bce3f88..afccbd113ea 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -1923,10 +1923,6 @@ public: zipClose(final_apk, NULL); unzClose(tmp_unaligned); - if (err) { - return err; - } - return OK; } diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 0fe91f3d002..ff532cba774 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1165,7 +1165,7 @@ int OS_X11::get_screen_dpi(int p_screen) const { int height_mm = DisplayHeightMM(x11_display, p_screen); double xdpi = (width_mm ? sc.width / (double)width_mm * 25.4 : 0); double ydpi = (height_mm ? sc.height / (double)height_mm * 25.4 : 0); - if (xdpi || xdpi) + if (xdpi || ydpi) return (xdpi + ydpi) / (xdpi && ydpi ? 2 : 1); //could not get dpi diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 690f1d4b4a5..578c9aa5f94 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -1275,9 +1275,6 @@ Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const if (collided) { found_collision = true; - } - - if (collided) { colliders.push_back(collision); motion = collision.remainder; diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 05214ed6695..e2dc89aa6e2 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -1203,9 +1203,6 @@ Vector3 KinematicBody::move_and_slide(const Vector3 &p_linear_velocity, const Ve if (collided) { found_collision = true; - } - - if (collided) { colliders.push_back(collision); motion = collision.remainder; diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 806c8afa5bb..d68cdd5f8db 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -59,7 +59,7 @@ void BaseButton::_gui_input(Ref p_event) { Ref b = p_event; if (b.is_valid()) { - if (status.disabled || ((1 << (b->get_button_index() - 1)) & button_mask) == 0) + if (((1 << (b->get_button_index() - 1)) & button_mask) == 0) return; if (status.pressing_button) diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 28b124d143c..01cec6fd31a 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -239,7 +239,7 @@ void PopupMenu::_gui_input(const Ref &p_event) { for (int i = search_from; i >= 0; i--) { - if (i < 0 || i >= items.size()) + if (i >= items.size()) continue; if (!items[i].separator && !items[i].disabled) { diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 8968923b2ce..496e0b626ac 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1996,7 +1996,7 @@ bool RichTextLabel::search(const String &p_string, bool p_from_selection, bool p Item *it = main; int charidx = 0; - if (p_from_selection && selection.active && selection.enabled) { + if (p_from_selection && selection.active) { it = selection.to; charidx = selection.to_char + 1; } diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 49cad6fccfd..057815f7984 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3930,7 +3930,6 @@ Tree::Tree() { cache.click_item = NULL; cache.click_column = 0; cache.hover_cell = -1; - cache.hover_index = -1; last_keypress = 0; focus_in_id = 0; diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index 8b68b3215c7..e65314644ef 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -286,7 +286,7 @@ bool HTTPRequest::_update_connection() { call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, PoolByteArray()); return true; } - if (got_response && body_len < 0) { + if (body_len < 0) { // Chunked transfer is done call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, body); return true; diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp index 464ca60d31a..ece8ad4bb06 100644 --- a/scene/resources/curve.cpp +++ b/scene/resources/curve.cpp @@ -268,7 +268,7 @@ void Curve::update_auto_tangents(int i) { } if (i + 1 < _points.size()) { - if (p.right_mode == TANGENT_LINEAR && i + 1 < _points.size()) { + if (p.right_mode == TANGENT_LINEAR) { Vector2 v = (_points[i + 1].pos - p.pos).normalized(); p.right_tangent = v.y / v.x; } diff --git a/servers/audio/audio_rb_resampler.cpp b/servers/audio/audio_rb_resampler.cpp index 88f3ed8d151..ad5bcde3821 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 2dd71f94526..96d5c9df892 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 4ab92715f48..e52cc376c0c 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 56b87f620cd..66d2dcd417e 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 831764b40cb..f5acadd71c7 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 2590e29aef3..6841819eead 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -1864,7 +1864,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(ins->base_data); @@ -1881,7 +1881,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(ins->base_data);