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
This commit is contained in:
Rémi Verschelde 2020-05-14 11:00:19 +02:00
parent 1a8167867b
commit dcd1151d77
31 changed files with 60 additions and 58 deletions

View File

@ -1,5 +1,5 @@
--- ---
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,modernize-use-default-member-init,modernize-use-nullptr' Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,modernize-use-bool-literals,modernize-use-default-member-init,modernize-use-nullptr'
WarningsAsErrors: '' WarningsAsErrors: ''
HeaderFilterRegex: '.*' HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false AnalyzeTemporaryDtors: false
@ -32,8 +32,10 @@ CheckOptions:
value: llvm value: llvm
- key: modernize-replace-auto-ptr.IncludeStyle - key: modernize-replace-auto-ptr.IncludeStyle
value: llvm value: llvm
- key: modernize-use-bool-literals.IgnoreMacros
value: '0'
- key: modernize-use-default-member-init.IgnoreMacros - key: modernize-use-default-member-init.IgnoreMacros
value: '1' value: '0'
- key: modernize-use-default-member-init.UseAssignment - key: modernize-use-default-member-init.UseAssignment
value: '1' value: '1'
- key: modernize-use-nullptr.NullMacros - key: modernize-use-nullptr.NullMacros

View File

@ -474,7 +474,7 @@ void Image::convert(Format p_new_format) {
} else if (format > FORMAT_RGBA8 || p_new_format > FORMAT_RGBA8) { } else if (format > FORMAT_RGBA8 || p_new_format > FORMAT_RGBA8) {
//use put/set pixel which is slower but works with non byte formats //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);
for (int i = 0; i < width; i++) { for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) { for (int j = 0; j < height; j++) {
@ -492,7 +492,7 @@ void Image::convert(Format p_new_format) {
return; return;
} }
Image new_img(width, height, 0, p_new_format); Image new_img(width, height, false, p_new_format);
const uint8_t *rptr = data.ptr(); const uint8_t *rptr = data.ptr();
uint8_t *wptr = new_img.data.ptrw(); uint8_t *wptr = new_img.data.ptrw();
@ -991,7 +991,7 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {
if (p_width == width && p_height == height) if (p_width == width && p_height == height)
return; return;
Image dst(p_width, p_height, 0, format); Image dst(p_width, p_height, false, format);
// Setup mipmap-aware scaling // Setup mipmap-aware scaling
Image dst2; Image dst2;
@ -1011,7 +1011,7 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {
} }
bool interpolate_mipmaps = mipmap_aware && mip1 != mip2; bool interpolate_mipmaps = mipmap_aware && mip1 != mip2;
if (interpolate_mipmaps) { if (interpolate_mipmaps) {
dst2.create(p_width, p_height, 0, format); dst2.create(p_width, p_height, false, format);
} }
bool had_mipmaps = mipmaps; bool had_mipmaps = mipmaps;
@ -1304,7 +1304,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 uint8_t pdata[16]; //largest is 16
uint32_t pixel_size = get_format_pixel_size(format); 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);
{ {
const uint8_t *r = data.ptr(); const uint8_t *r = data.ptr();
@ -2157,7 +2157,7 @@ void Image::create(const char **p_xpm) {
if (line == colormap_size) { if (line == colormap_size) {
status = READING_PIXELS; 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.ptrw(); w = data.ptrw();
pixel_size = has_alpha ? 4 : 3; pixel_size = has_alpha ? 4 : 3;
} }
@ -3329,7 +3329,7 @@ Ref<Image> Image::rgbe_to_srgb() {
Ref<Image> new_image; Ref<Image> new_image;
new_image.instance(); new_image.instance();
new_image->create(width, height, 0, Image::FORMAT_RGB8); new_image->create(width, height, false, Image::FORMAT_RGB8);
for (int row = 0; row < height; row++) { for (int row = 0; row < height; row++) {
for (int col = 0; col < width; col++) { for (int col = 0; col < width; col++) {

View File

@ -283,7 +283,7 @@ void HTTPClient::close() {
body_size = -1; body_size = -1;
body_left = 0; body_left = 0;
chunk_left = 0; chunk_left = 0;
chunk_trailer_part = 0; chunk_trailer_part = false;
read_until_eof = false; read_until_eof = false;
response_num = 0; response_num = 0;
handshaking = false; handshaking = false;

View File

@ -90,7 +90,7 @@ private:
uint32_t pos = hash % capacity; uint32_t pos = hash % capacity;
uint32_t distance = 0; uint32_t distance = 0;
while (42) { while (true) {
if (hashes[pos] == EMPTY_HASH) { if (hashes[pos] == EMPTY_HASH) {
return false; return false;
} }
@ -118,7 +118,7 @@ private:
TKey key = p_key; TKey key = p_key;
TValue value = p_value; TValue value = p_value;
while (42) { while (true) {
if (hashes[pos] == EMPTY_HASH) { if (hashes[pos] == EMPTY_HASH) {
_construct(pos, hash, key, value); _construct(pos, hash, key, value);

View File

@ -115,7 +115,7 @@ Error png_to_image(const uint8_t *p_source, size_t p_size, Ref<Image> p_image) {
ERR_FAIL_COND_V(!success, ERR_FILE_CORRUPT); ERR_FAIL_COND_V(!success, ERR_FILE_CORRUPT);
//print_line("png width: "+itos(png_img.width)+" height: "+itos(png_img.height)); //print_line("png width: "+itos(png_img.width)+" height: "+itos(png_img.height));
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; return OK;
} }

View File

@ -47,7 +47,7 @@
class NetSocketPosix : public NetSocket { class NetSocketPosix : public NetSocket {
private: private:
SOCKET_TYPE _sock; SOCKET_TYPE _sock; // NOLINT - the default value is defined in the .cpp
IP::Type _ip_type = IP::TYPE_NONE; IP::Type _ip_type = IP::TYPE_NONE;
bool _is_stream = false; bool _is_stream = false;

View File

@ -5955,7 +5955,7 @@ AnimationTrackEditor::AnimationTrackEditor() {
insert_confirm_bezier->set_text(TTR("Use Bezier Curves")); insert_confirm_bezier->set_text(TTR("Use Bezier Curves"));
icvb->add_child(insert_confirm_bezier); icvb->add_child(insert_confirm_bezier);
keying = false; keying = false;
moving_selection = 0; moving_selection = false;
key_edit = nullptr; key_edit = nullptr;
multi_key_edit = nullptr; multi_key_edit = nullptr;

View File

@ -344,7 +344,7 @@ void EditorProfiler::_update_plot() {
Ref<Image> img; Ref<Image> img;
img.instance(); 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 (reset_texture) {

View File

@ -307,7 +307,7 @@ void EditorVisualProfiler::_update_plot() {
Ref<Image> img; Ref<Image> img;
img.instance(); 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 (reset_texture) {

View File

@ -864,7 +864,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
ProjectSettings::CustomMap custom_map; ProjectSettings::CustomMap custom_map;
if (path_remaps.size()) { 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) { for (int i = 0; i < path_remaps.size(); i += 2) {
String from = path_remaps[i]; String from = path_remaps[i];
String to = path_remaps[i + 1]; String to = path_remaps[i + 1];

View File

@ -526,7 +526,7 @@ void EditorHelp::_update_doc() {
class_desc->push_font(doc_code_font); class_desc->push_font(doc_code_font);
class_desc->push_indent(1); class_desc->push_indent(1);
class_desc->push_table(2); 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++) { 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 property_line[cd.properties[i].name] = class_desc->get_line_count() - 2; //gets overridden if description
@ -629,7 +629,7 @@ void EditorHelp::_update_doc() {
class_desc->push_font(doc_code_font); class_desc->push_font(doc_code_font);
class_desc->push_indent(1); class_desc->push_indent(1);
class_desc->push_table(2); 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; bool any_previous = false;
for (int pass = 0; pass < 2; pass++) { for (int pass = 0; pass < 2; pass++) {
@ -698,7 +698,7 @@ void EditorHelp::_update_doc() {
class_desc->push_indent(1); class_desc->push_indent(1);
class_desc->push_table(2); 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++) { for (int i = 0; i < cd.theme_properties.size(); i++) {
@ -1005,7 +1005,7 @@ void EditorHelp::_update_doc() {
property_line[cd.properties[i].name] = class_desc->get_line_count() - 2; property_line[cd.properties[i].name] = class_desc->get_line_count() - 2;
class_desc->push_table(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_cell();
class_desc->push_font(doc_code_font); class_desc->push_font(doc_code_font);

View File

@ -797,7 +797,7 @@ Ref<Texture2D> CurvePreviewGenerator::generate(const Ref<Resource> &p_from, cons
img_ref.instance(); img_ref.instance();
Image &im = **img_ref; 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);
Color bg_color(0.1, 0.1, 0.1, 1.0); Color bg_color(0.1, 0.1, 0.1, 1.0);
for (int i = 0; i < thumbnail_size; i++) { for (int i = 0; i < thumbnail_size; i++) {

View File

@ -223,7 +223,7 @@ Ref<Texture2D> EditorBitmapPreviewPlugin::generate(const RES &p_from, const Size
Ref<Image> img; Ref<Image> img;
img.instance(); 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->is_compressed()) {
if (img->decompress() != OK) if (img->decompress() != OK)
@ -511,7 +511,7 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size
Ref<Image> img; Ref<Image> img;
img.instance(); img.instance();
int thumbnail_size = MAX(p_size.x, p_size.y); 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 bg_color = EditorSettings::get_singleton()->get("text_editor/highlighting/background_color");
Color keyword_color = EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"); Color keyword_color = EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color");

View File

@ -168,7 +168,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
//generate previews! //generate previews!
if (1) { if (true) {
Vector<Ref<Mesh>> meshes; Vector<Ref<Mesh>> meshes;
Vector<Transform> transforms; Vector<Transform> transforms;

View File

@ -3885,7 +3885,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
_edit.mode = TRANSFORM_NONE; _edit.mode = TRANSFORM_NONE;
_edit.plane = TRANSFORM_VIEW; _edit.plane = TRANSFORM_VIEW;
_edit.edited_gizmo = 0; _edit.edited_gizmo = 0;
_edit.snap = 1; _edit.snap = true;
_edit.gizmo_handle = 0; _edit.gizmo_handle = 0;
index = p_index; index = p_index;

View File

@ -153,7 +153,7 @@ Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image,
if (p_color_buffer == nullptr || color_table_size == 0) { // regular pixels 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 } else { // data is in indexed format, extend it
@ -193,7 +193,7 @@ Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image,
dest += 4; 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; return err;

View File

@ -205,7 +205,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 /// 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<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) { 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<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
if (p_result_max <= 0) if (p_result_max <= 0)
return 0; return false;
ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->getornull(p_shape); ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->getornull(p_shape);
@ -213,7 +213,7 @@ bool BulletPhysicsDirectSpaceState::collide_shape(RID p_shape, const Transform &
if (!btShape->isConvex()) { if (!btShape->isConvex()) {
bulletdelete(btShape); bulletdelete(btShape);
ERR_PRINT("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type())); ERR_PRINT("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<btConvexShape *>(btShape); btConvexShape *btConvex = static_cast<btConvexShape *>(btShape);
@ -245,7 +245,7 @@ bool BulletPhysicsDirectSpaceState::rest_info(RID p_shape, const Transform &p_sh
if (!btShape->isConvex()) { if (!btShape->isConvex()) {
bulletdelete(btShape); bulletdelete(btShape);
ERR_PRINT("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type())); ERR_PRINT("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<btConvexShape *>(btShape); btConvexShape *btConvex = static_cast<btConvexShape *>(btShape);

View File

@ -130,15 +130,15 @@ static const TBuiltInResource default_builtin_resource = {
/*maxTaskWorkGroupSizeZ_NV*/ 0, /*maxTaskWorkGroupSizeZ_NV*/ 0,
/*maxMeshViewCountNV*/ 0, /*maxMeshViewCountNV*/ 0,
/*limits*/ { /*limits*/ {
/*nonInductiveForLoops*/ 1, /*nonInductiveForLoops*/ true,
/*whileLoops*/ 1, /*whileLoops*/ true,
/*doWhileLoops*/ 1, /*doWhileLoops*/ true,
/*generalUniformIndexing*/ 1, /*generalUniformIndexing*/ true,
/*generalAttributeMatrixVectorIndexing*/ 1, /*generalAttributeMatrixVectorIndexing*/ true,
/*generalVaryingIndexing*/ 1, /*generalVaryingIndexing*/ true,
/*generalSamplerIndexing*/ 1, /*generalSamplerIndexing*/ true,
/*generalVariableIndexing*/ 1, /*generalVariableIndexing*/ true,
/*generalConstantMatrixVectorIndexing*/ 1, /*generalConstantMatrixVectorIndexing*/ true,
} }
}; };

View File

@ -1405,8 +1405,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
Vector3 points[4]; Vector3 points[4];
for (int j = 0; j < 4; j++) { for (int j = 0; j < 4; j++) {
static const bool orderx[4] = { 0, 1, 1, 0 }; static const bool orderx[4] = { false, true, true, false };
static const bool ordery[4] = { 0, 0, 1, 1 }; static const bool ordery[4] = { false, false, true, true };
Vector3 sp; Vector3 sp;
if (orderx[j]) { if (orderx[j]) {

View File

@ -96,7 +96,7 @@ Error jpeg_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p
else else
fmt = Image::FORMAT_RGB8; fmt = Image::FORMAT_RGB8;
p_image->create(image_width, image_height, 0, fmt, data); p_image->create(image_width, image_height, false, fmt, data);
return OK; return OK;
} }

View File

@ -261,9 +261,9 @@ struct PVRTCBlock {
_FORCE_INLINE_ bool is_po2(uint32_t p_input) { _FORCE_INLINE_ bool is_po2(uint32_t p_input) {
if (p_input == 0) if (p_input == 0)
return 0; return false;
uint32_t minus1 = p_input - 1; 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]) { static void unpack_5554(const PVRTCBlock *p_block, int p_ab_colors[2][4]) {

View File

@ -199,7 +199,7 @@ Error ImageLoaderTGA::convert_to_image(Ref<Image> p_image, const uint8_t *p_buff
} }
} }
p_image->create(width, height, 0, Image::FORMAT_RGBA8, image_data); p_image->create(width, height, false, Image::FORMAT_RGBA8, image_data);
return OK; return OK;
} }

View File

@ -172,7 +172,7 @@ void VisualScriptPropertySelector::_update_search() {
item->set_metadata(0, F->get().name); item->set_metadata(0, F->get().name);
item->set_icon(0, type_icons[F->get().type]); item->set_icon(0, type_icons[F->get().type]);
item->set_metadata(1, "get"); item->set_metadata(1, "get");
item->set_collapsed(1); item->set_collapsed(true);
item->set_selectable(0, true); item->set_selectable(0, true);
item->set_selectable(1, false); item->set_selectable(1, false);
item->set_selectable(2, false); item->set_selectable(2, false);
@ -257,7 +257,7 @@ void VisualScriptPropertySelector::_update_search() {
item->set_selectable(0, true); item->set_selectable(0, true);
item->set_metadata(1, "method"); item->set_metadata(1, "method");
item->set_collapsed(1); item->set_collapsed(true);
item->set_selectable(1, false); item->set_selectable(1, false);
item->set_selectable(2, false); item->set_selectable(2, false);
@ -320,7 +320,7 @@ void VisualScriptPropertySelector::create_visualscript_item(const String &name,
item->set_metadata(0, name); item->set_metadata(0, name);
item->set_metadata(1, "action"); item->set_metadata(1, "action");
item->set_selectable(0, true); item->set_selectable(0, true);
item->set_collapsed(1); item->set_collapsed(true);
item->set_selectable(1, false); item->set_selectable(1, false);
item->set_selectable(2, false); item->set_selectable(2, false);
item->set_metadata(2, connecting); item->set_metadata(2, connecting);

View File

@ -135,7 +135,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."); 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; return OK;
} }

View File

@ -723,7 +723,7 @@ void Polygon2D::_bind_methods() {
Polygon2D::Polygon2D() { Polygon2D::Polygon2D() {
invert = 0; invert = false;
invert_border = 100; invert_border = 100;
antialiased = false; antialiased = false;
tex_rot = 0; tex_rot = 0;

View File

@ -2690,7 +2690,7 @@ BaseMaterial3D::BaseMaterial3D(bool p_orm) :
depth_draw_mode = DEPTH_DRAW_OPAQUE_ONLY; depth_draw_mode = DEPTH_DRAW_OPAQUE_ONLY;
cull_mode = CULL_BACK; cull_mode = CULL_BACK;
for (int i = 0; i < FLAG_MAX; i++) { for (int i = 0; i < FLAG_MAX; i++) {
flags[i] = 0; flags[i] = false;
} }
flags[FLAG_USE_TEXTURE_REPEAT] = true; flags[FLAG_USE_TEXTURE_REPEAT] = true;

View File

@ -311,7 +311,7 @@ bool PhysicsDirectSpaceState2DSW::cast_motion(const RID &p_shape, const Transfor
bool PhysicsDirectSpaceState2DSW::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<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) { bool PhysicsDirectSpaceState2DSW::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<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
if (p_result_max <= 0) if (p_result_max <= 0)
return 0; return false;
Shape2DSW *shape = PhysicsServer2DSW::singletonsw->shape_owner.getornull(p_shape); Shape2DSW *shape = PhysicsServer2DSW::singletonsw->shape_owner.getornull(p_shape);
ERR_FAIL_COND_V(!shape, 0); ERR_FAIL_COND_V(!shape, 0);

View File

@ -688,5 +688,5 @@ bool Generic6DOFJoint3DSW::get_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOF
break; // Can't happen, but silences warning break; // Can't happen, but silences warning
} }
return 0; return false;
} }

View File

@ -307,7 +307,7 @@ public:
virtual void soft_body_remove_all_pinned_points(RID p_body) {} 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 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 */ /* JOINT API */

View File

@ -331,7 +331,7 @@ bool PhysicsDirectSpaceState3DSW::cast_motion(const RID &p_shape, const Transfor
bool PhysicsDirectSpaceState3DSW::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<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) { bool PhysicsDirectSpaceState3DSW::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<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
if (p_result_max <= 0) if (p_result_max <= 0)
return 0; return false;
Shape3DSW *shape = static_cast<PhysicsServer3DSW *>(PhysicsServer3D::get_singleton())->shape_owner.getornull(p_shape); Shape3DSW *shape = static_cast<PhysicsServer3DSW *>(PhysicsServer3D::get_singleton())->shape_owner.getornull(p_shape);
ERR_FAIL_COND_V(!shape, 0); ERR_FAIL_COND_V(!shape, 0);

View File

@ -2732,7 +2732,7 @@ void RasterizerStorageRD::_multimesh_make_local(MultiMesh *multimesh) const {
uint32_t data_cache_dirty_region_count = (multimesh->instances - 1) / MULTIMESH_DIRTY_REGION_SIZE + 1; uint32_t data_cache_dirty_region_count = (multimesh->instances - 1) / MULTIMESH_DIRTY_REGION_SIZE + 1;
multimesh->data_cache_dirty_regions = memnew_arr(bool, data_cache_dirty_region_count); multimesh->data_cache_dirty_regions = memnew_arr(bool, data_cache_dirty_region_count);
for (uint32_t i = 0; i < data_cache_dirty_region_count; i++) { for (uint32_t i = 0; i < data_cache_dirty_region_count; i++) {
multimesh->data_cache_dirty_regions[i] = 0; multimesh->data_cache_dirty_regions[i] = false;
} }
multimesh->data_cache_used_dirty_regions = 0; multimesh->data_cache_used_dirty_regions = 0;
} }