From b4af1eba0adc229c4fd72cc648532e99d4cf0576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 4 May 2021 16:28:24 +0200 Subject: [PATCH] Style: Enforce use of bool literals instead of integers Using clang-tidy's `modernize-use-bool-literals`. https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html --- .clang-tidy | 2 +- core/image.cpp | 14 +++++++------- core/io/http_client.cpp | 2 +- core/oa_hash_map.h | 4 ++-- core/os/os.h | 2 +- drivers/png/png_driver_common.cpp | 2 +- editor/animation_track_editor.cpp | 2 +- editor/editor_export.cpp | 2 +- editor/editor_help.cpp | 8 ++++---- editor/editor_node.cpp | 2 +- editor/editor_profiler.cpp | 2 +- editor/plugins/curve_editor_plugin.cpp | 2 +- editor/plugins/editor_preview_plugins.cpp | 4 ++-- editor/plugins/mesh_library_editor_plugin.cpp | 2 +- editor/plugins/spatial_editor_plugin.cpp | 2 +- modules/bmp/image_loader_bmp.cpp | 4 ++-- modules/bullet/space_bullet.cpp | 6 +++--- modules/gridmap/grid_map_editor_plugin.cpp | 4 ++-- modules/jpg/image_loader_jpegd.cpp | 2 +- modules/pvr/texture_loader_pvr.cpp | 4 ++-- modules/tga/image_loader_tga.cpp | 2 +- .../visual_script_property_selector.cpp | 6 +++--- modules/webp/image_loader_webp.cpp | 2 +- scene/2d/polygon_2d.cpp | 2 +- scene/resources/material.cpp | 2 +- servers/physics/joints/generic_6dof_joint_sw.cpp | 2 +- servers/physics/physics_server_sw.h | 2 +- servers/physics/space_sw.cpp | 2 +- servers/physics_2d/space_2d_sw.cpp | 2 +- 29 files changed, 47 insertions(+), 47 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 4edb587505c..2906e66c8dd 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,5 @@ --- -Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,modernize-use-nullptr' +Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,modernize-use-bool-literals,modernize-use-nullptr' WarningsAsErrors: '' HeaderFilterRegex: '.*' AnalyzeTemporaryDtors: false diff --git a/core/image.cpp b/core/image.cpp index 03b045d6472..4aa0abe0638 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -420,7 +420,7 @@ void Image::convert(Format p_new_format) { } else if (format > FORMAT_RGBA8 || p_new_format > FORMAT_RGBA8) { //use put/set pixel which is slower but works with non byte formats - Image new_img(width, height, 0, p_new_format); + Image new_img(width, height, false, p_new_format); lock(); new_img.lock(); @@ -442,7 +442,7 @@ void Image::convert(Format p_new_format) { return; } - Image new_img(width, height, 0, p_new_format); + Image new_img(width, height, false, p_new_format); PoolVector::Read r = data.read(); PoolVector::Write w = new_img.data.write(); @@ -926,7 +926,7 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) { if (p_width == width && p_height == height) return; - Image dst(p_width, p_height, 0, format); + Image dst(p_width, p_height, false, format); // Setup mipmap-aware scaling Image dst2; @@ -946,7 +946,7 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) { } bool interpolate_mipmaps = mipmap_aware && mip1 != mip2; if (interpolate_mipmaps) { - dst2.create(p_width, p_height, 0, format); + dst2.create(p_width, p_height, false, format); } bool had_mipmaps = mipmaps; @@ -1236,7 +1236,7 @@ void Image::crop_from_point(int p_x, int p_y, int p_width, int p_height) { uint8_t pdata[16]; //largest is 16 uint32_t pixel_size = get_format_pixel_size(format); - Image dst(p_width, p_height, 0, format); + Image dst(p_width, p_height, false, format); { PoolVector::Read r = data.read(); @@ -1850,7 +1850,7 @@ void Image::create(const char **p_xpm) { } if (line == colormap_size) { status = READING_PIXELS; - create(size_width, size_height, 0, has_alpha ? FORMAT_RGBA8 : FORMAT_RGB8); + create(size_width, size_height, false, has_alpha ? FORMAT_RGBA8 : FORMAT_RGB8); w = data.write(); pixel_size = has_alpha ? 4 : 3; } @@ -2936,7 +2936,7 @@ Ref Image::rgbe_to_srgb() { Ref new_image; new_image.instance(); - new_image->create(width, height, 0, Image::FORMAT_RGB8); + new_image->create(width, height, false, Image::FORMAT_RGB8); lock(); diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 073a2c0e066..471db20c35d 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -309,7 +309,7 @@ void HTTPClient::close() { body_size = -1; body_left = 0; chunk_left = 0; - chunk_trailer_part = 0; + chunk_trailer_part = false; read_until_eof = false; response_num = 0; handshaking = false; diff --git a/core/oa_hash_map.h b/core/oa_hash_map.h index fd6652603c2..c41626bef1a 100644 --- a/core/oa_hash_map.h +++ b/core/oa_hash_map.h @@ -91,7 +91,7 @@ private: uint32_t pos = hash % capacity; uint32_t distance = 0; - while (42) { + while (true) { if (hashes[pos] == EMPTY_HASH) { return false; } @@ -118,7 +118,7 @@ private: TKey key = p_key; TValue value = p_value; - while (42) { + while (true) { if (hashes[pos] == EMPTY_HASH) { _construct(pos, hash, key, value); diff --git a/core/os/os.h b/core/os/os.h index 19bc28097fd..f5994cd0c16 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -264,7 +264,7 @@ public: } virtual void set_borderless_window(bool p_borderless) {} - virtual bool get_borderless_window() { return 0; } + virtual bool get_borderless_window() { return false; } virtual bool get_window_per_pixel_transparency_enabled() const { return false; } virtual void set_window_per_pixel_transparency_enabled(bool p_enabled) {} diff --git a/drivers/png/png_driver_common.cpp b/drivers/png/png_driver_common.cpp index 0516111bc1d..c525040e73f 100644 --- a/drivers/png/png_driver_common.cpp +++ b/drivers/png/png_driver_common.cpp @@ -118,7 +118,7 @@ Error png_to_image(const uint8_t *p_source, size_t p_size, bool p_force_linear, ERR_FAIL_COND_V_MSG(check_error(png_img), ERR_FILE_CORRUPT, png_img.message); ERR_FAIL_COND_V(!success, ERR_FILE_CORRUPT); - p_image->create(png_img.width, png_img.height, 0, dest_format, buffer); + p_image->create(png_img.width, png_img.height, false, dest_format, buffer); return OK; } diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 421a5910998..147184b441a 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -5659,7 +5659,7 @@ AnimationTrackEditor::AnimationTrackEditor() { insert_confirm_bezier->set_text(TTR("Use Bezier Curves")); icvb->add_child(insert_confirm_bezier); keying = false; - moving_selection = 0; + moving_selection = false; key_edit = nullptr; multi_key_edit = nullptr; diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 69e42cce751..aa33596019f 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -869,7 +869,7 @@ Error EditorExportPlatform::export_project_files(const Ref & ProjectSettings::CustomMap custom_map; if (path_remaps.size()) { - if (1) { //new remap mode, use always as it's friendlier with multiple .pck exports + if (true) { //new remap mode, use always as it's friendlier with multiple .pck exports for (int i = 0; i < path_remaps.size(); i += 2) { String from = path_remaps[i]; String to = path_remaps[i + 1]; diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index c57e44e3363..e26bc51078e 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -494,7 +494,7 @@ void EditorHelp::_update_doc() { class_desc->push_font(doc_code_font); class_desc->push_indent(1); class_desc->push_table(2); - class_desc->set_table_column_expand(1, 1); + class_desc->set_table_column_expand(1, true); for (int i = 0; i < cd.properties.size(); i++) { property_line[cd.properties[i].name] = class_desc->get_line_count() - 2; //gets overridden if description @@ -596,7 +596,7 @@ void EditorHelp::_update_doc() { class_desc->push_font(doc_code_font); class_desc->push_indent(1); class_desc->push_table(2); - class_desc->set_table_column_expand(1, 1); + class_desc->set_table_column_expand(1, true); bool any_previous = false; for (int pass = 0; pass < 2; pass++) { @@ -664,7 +664,7 @@ void EditorHelp::_update_doc() { class_desc->push_indent(1); class_desc->push_table(2); - class_desc->set_table_column_expand(1, 1); + class_desc->set_table_column_expand(1, true); for (int i = 0; i < cd.theme_properties.size(); i++) { theme_property_line[cd.theme_properties[i].name] = class_desc->get_line_count() - 2; //gets overridden if description @@ -957,7 +957,7 @@ void EditorHelp::_update_doc() { property_line[cd.properties[i].name] = class_desc->get_line_count() - 2; class_desc->push_table(2); - class_desc->set_table_column_expand(1, 1); + class_desc->set_table_column_expand(1, true); class_desc->push_cell(); class_desc->push_font(doc_code_font); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 40fa9cc45c6..5d7d856f005 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1263,7 +1263,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) { // which would result in an invalid texture. if (c3d == 0 && c2d == 0) { img.instance(); - img->create(1, 1, 0, Image::FORMAT_RGB8); + img->create(1, 1, false, Image::FORMAT_RGB8); } else if (c3d < c2d) { Ref viewport_texture = scene_root->get_texture(); if (viewport_texture->get_width() > 0 && viewport_texture->get_height() > 0) { diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp index 187b91037cf..030ad290230 100644 --- a/editor/editor_profiler.cpp +++ b/editor/editor_profiler.cpp @@ -331,7 +331,7 @@ void EditorProfiler::_update_plot() { Ref img; img.instance(); - img->create(w, h, 0, Image::FORMAT_RGBA8, graph_image); + img->create(w, h, false, Image::FORMAT_RGBA8, graph_image); if (reset_texture) { if (graph_texture.is_null()) { diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index e46ff31d614..0c5e12e6d08 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -784,7 +784,7 @@ Ref CurvePreviewGenerator::generate(const Ref &p_from, const img_ref.instance(); Image &im = **img_ref; - im.create(thumbnail_size, thumbnail_size / 2, 0, Image::FORMAT_RGBA8); + im.create(thumbnail_size, thumbnail_size / 2, false, Image::FORMAT_RGBA8); im.lock(); diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index a005879d24d..76c8fa5d8c6 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -221,7 +221,7 @@ Ref EditorBitmapPreviewPlugin::generate(const RES &p_from, const Size2 Ref img; img.instance(); - img->create(bm->get_size().width, bm->get_size().height, 0, Image::FORMAT_L8, data); + img->create(bm->get_size().width, bm->get_size().height, false, Image::FORMAT_L8, data); if (img->is_compressed()) { if (img->decompress() != OK) @@ -493,7 +493,7 @@ Ref EditorScriptPreviewPlugin::generate(const RES &p_from, const Size2 Ref img; img.instance(); int thumbnail_size = MAX(p_size.x, p_size.y); - img->create(thumbnail_size, thumbnail_size, 0, Image::FORMAT_RGBA8); + img->create(thumbnail_size, thumbnail_size, false, Image::FORMAT_RGBA8); Color bg_color = EditorSettings::get_singleton()->get("text_editor/highlighting/background_color"); Color keyword_color = EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"); diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index e40a0a659b5..e9f2c01d182 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -159,7 +159,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref p_library, //generate previews! - if (1) { + if (true) { Vector> meshes; Vector transforms; Vector ids = p_library->get_item_list(); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 25c1b02db7a..07671efb6da 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -3666,7 +3666,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed _edit.mode = TRANSFORM_NONE; _edit.plane = TRANSFORM_VIEW; _edit.edited_gizmo = 0; - _edit.snap = 1; + _edit.snap = true; _edit.gizmo_handle = 0; index = p_index; diff --git a/modules/bmp/image_loader_bmp.cpp b/modules/bmp/image_loader_bmp.cpp index bd7d1012b9b..bf6b1aa3f94 100644 --- a/modules/bmp/image_loader_bmp.cpp +++ b/modules/bmp/image_loader_bmp.cpp @@ -157,7 +157,7 @@ Error ImageLoaderBMP::convert_to_image(Ref p_image, if (p_color_buffer == nullptr || color_table_size == 0) { // regular pixels - p_image->create(width, height, 0, Image::FORMAT_RGBA8, data); + p_image->create(width, height, false, Image::FORMAT_RGBA8, data); } else { // data is in indexed format, extend it @@ -197,7 +197,7 @@ Error ImageLoaderBMP::convert_to_image(Ref p_image, dest += 4; } - p_image->create(width, height, 0, Image::FORMAT_RGBA8, extended_data); + p_image->create(width, height, false, Image::FORMAT_RGBA8, extended_data); } } return err; diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index d5dd6ff4d63..17cc6c22154 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -215,7 +215,7 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf /// Returns the list of contacts pairs in this order: Local contact, other body contact bool BulletPhysicsDirectSpaceState::collide_shape(RID p_shape, const Transform &p_shape_xform, float p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) { if (p_result_max <= 0) - return 0; + return false; ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->get(p_shape); ERR_FAIL_COND_V(!shape, false); @@ -224,7 +224,7 @@ bool BulletPhysicsDirectSpaceState::collide_shape(RID p_shape, const Transform & if (!btShape->isConvex()) { bulletdelete(btShape); ERR_PRINTS("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type())); - return 0; + return false; } btConvexShape *btConvex = static_cast(btShape); @@ -256,7 +256,7 @@ bool BulletPhysicsDirectSpaceState::rest_info(RID p_shape, const Transform &p_sh if (!btShape->isConvex()) { bulletdelete(btShape); ERR_PRINTS("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type())); - return 0; + return false; } btConvexShape *btConvex = static_cast(btShape); diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index 4c10b4ae9db..3d11d9c4e69 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -1328,8 +1328,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { for (int i = 0; i < 3; i++) { Vector3 points[4]; for (int j = 0; j < 4; j++) { - static const bool orderx[4] = { 0, 1, 1, 0 }; - static const bool ordery[4] = { 0, 0, 1, 1 }; + static const bool orderx[4] = { false, true, true, false }; + static const bool ordery[4] = { false, false, true, true }; Vector3 sp; if (orderx[j]) { diff --git a/modules/jpg/image_loader_jpegd.cpp b/modules/jpg/image_loader_jpegd.cpp index 1679873e7ba..0b8e3721267 100644 --- a/modules/jpg/image_loader_jpegd.cpp +++ b/modules/jpg/image_loader_jpegd.cpp @@ -96,7 +96,7 @@ Error jpeg_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p fmt = Image::FORMAT_RGB8; dw.release(); - p_image->create(image_width, image_height, 0, fmt, data); + p_image->create(image_width, image_height, false, fmt, data); return OK; } diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp index e5b8ec6603b..203317114af 100644 --- a/modules/pvr/texture_loader_pvr.cpp +++ b/modules/pvr/texture_loader_pvr.cpp @@ -214,9 +214,9 @@ struct PVRTCBlock { _FORCE_INLINE_ bool is_po2(uint32_t p_input) { if (p_input == 0) - return 0; + return false; uint32_t minus1 = p_input - 1; - return ((p_input | minus1) == (p_input ^ minus1)) ? 1 : 0; + return ((p_input | minus1) == (p_input ^ minus1)) ? true : false; } static void unpack_5554(const PVRTCBlock *p_block, int p_ab_colors[2][4]) { diff --git a/modules/tga/image_loader_tga.cpp b/modules/tga/image_loader_tga.cpp index e99e040a647..10183632130 100644 --- a/modules/tga/image_loader_tga.cpp +++ b/modules/tga/image_loader_tga.cpp @@ -220,7 +220,7 @@ Error ImageLoaderTGA::convert_to_image(Ref p_image, const uint8_t *p_buff image_data_w.release(); - p_image->create(width, height, 0, Image::FORMAT_RGBA8, image_data); + p_image->create(width, height, false, Image::FORMAT_RGBA8, image_data); return OK; } diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp index e5ce14a15ed..8b93766a9ee 100644 --- a/modules/visual_script/visual_script_property_selector.cpp +++ b/modules/visual_script/visual_script_property_selector.cpp @@ -167,7 +167,7 @@ void VisualScriptPropertySelector::_update_search() { item->set_metadata(0, F->get().name); item->set_icon(0, type_icons[F->get().type]); item->set_metadata(1, "get"); - item->set_collapsed(1); + item->set_collapsed(true); item->set_selectable(0, true); item->set_selectable(1, false); item->set_selectable(2, false); @@ -249,7 +249,7 @@ void VisualScriptPropertySelector::_update_search() { item->set_selectable(0, true); item->set_metadata(1, "method"); - item->set_collapsed(1); + item->set_collapsed(true); item->set_selectable(1, false); item->set_selectable(2, false); @@ -312,7 +312,7 @@ void VisualScriptPropertySelector::create_visualscript_item(const String &name, item->set_metadata(0, name); item->set_metadata(1, "action"); item->set_selectable(0, true); - item->set_collapsed(1); + item->set_collapsed(true); item->set_selectable(1, false); item->set_selectable(2, false); item->set_metadata(2, connecting); diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp index d72b03c380a..61497bc914f 100644 --- a/modules/webp/image_loader_webp.cpp +++ b/modules/webp/image_loader_webp.cpp @@ -134,7 +134,7 @@ Error webp_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p ERR_FAIL_COND_V_MSG(errdec, ERR_FILE_CORRUPT, "Failed decoding WebP image."); - p_image->create(features.width, features.height, 0, features.has_alpha ? Image::FORMAT_RGBA8 : Image::FORMAT_RGB8, dst_image); + p_image->create(features.width, features.height, false, features.has_alpha ? Image::FORMAT_RGBA8 : Image::FORMAT_RGB8, dst_image); return OK; } diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index 89cd0bd836f..795662b3946 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -631,7 +631,7 @@ void Polygon2D::_bind_methods() { } Polygon2D::Polygon2D() { - invert = 0; + invert = false; invert_border = 100; antialiased = false; tex_rot = 0; diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 7b5b4a65c98..9ebc432a213 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -2277,7 +2277,7 @@ SpatialMaterial::SpatialMaterial() : depth_draw_mode = DEPTH_DRAW_OPAQUE_ONLY; cull_mode = CULL_BACK; for (int i = 0; i < FLAG_MAX; i++) { - flags[i] = 0; + flags[i] = false; } diffuse_mode = DIFFUSE_BURLEY; specular_mode = SPECULAR_SCHLICK_GGX; diff --git a/servers/physics/joints/generic_6dof_joint_sw.cpp b/servers/physics/joints/generic_6dof_joint_sw.cpp index 7110f732931..b2ceaf1ad79 100644 --- a/servers/physics/joints/generic_6dof_joint_sw.cpp +++ b/servers/physics/joints/generic_6dof_joint_sw.cpp @@ -652,5 +652,5 @@ bool Generic6DOFJointSW::get_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJoin break; // Can't happen, but silences warning } - return 0; + return false; } diff --git a/servers/physics/physics_server_sw.h b/servers/physics/physics_server_sw.h index 572ce93ddee..98fc348e8cd 100644 --- a/servers/physics/physics_server_sw.h +++ b/servers/physics/physics_server_sw.h @@ -303,7 +303,7 @@ public: virtual void soft_body_remove_all_pinned_points(RID p_body) {} virtual void soft_body_pin_point(RID p_body, int p_point_index, bool p_pin) {} - virtual bool soft_body_is_point_pinned(RID p_body, int p_point_index) { return 0; } + virtual bool soft_body_is_point_pinned(RID p_body, int p_point_index) { return false; } /* JOINT API */ diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp index 08bd2d39ed3..2615fd0e8a8 100644 --- a/servers/physics/space_sw.cpp +++ b/servers/physics/space_sw.cpp @@ -318,7 +318,7 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform &p_shape_xform, real_t p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) { if (p_result_max <= 0) - return 0; + return false; ShapeSW *shape = static_cast(PhysicsServer::get_singleton())->shape_owner.get(p_shape); ERR_FAIL_COND_V(!shape, 0); diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index 1e288563ef6..a86ac9c6c97 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -294,7 +294,7 @@ bool Physics2DDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transfor bool Physics2DDirectSpaceStateSW::collide_shape(RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, real_t p_margin, Vector2 *r_results, int p_result_max, int &r_result_count, const Set &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) { if (p_result_max <= 0) - return 0; + return false; Shape2DSW *shape = Physics2DServerSW::singletonsw->shape_owner.get(p_shape); ERR_FAIL_COND_V(!shape, 0);