diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-28 20:47:30 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-28 20:47:30 +0200 |
commit | a9591f30395643b98f9620b8d68a76f74d00b9cf (patch) | |
tree | df790fc67681d06b8e28aba8354c063ffd6ab373 /scene | |
parent | 361d9b514ef969a44f596c0bab9c86d9521379f3 (diff) | |
parent | 7ab01450cf465acb5981967e0276881e6d495904 (diff) |
Merge pull request #66543 from akien-mga/msvc-warning-c4702
Fix MSVC warning C4702: unreachable code
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/base_button.cpp | 7 | ||||
-rw-r--r-- | scene/gui/rich_text_label.cpp | 12 | ||||
-rw-r--r-- | scene/resources/animation.cpp | 4 | ||||
-rw-r--r-- | scene/resources/material.cpp | 2 | ||||
-rw-r--r-- | scene/resources/tile_set.cpp | 1 | ||||
-rw-r--r-- | scene/resources/visual_shader_particle_nodes.cpp | 47 |
6 files changed, 34 insertions, 39 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 3d95677dcf..af6a99ca62 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -264,7 +264,7 @@ bool BaseButton::is_hovered() const { BaseButton::DrawMode BaseButton::get_draw_mode() const { if (status.disabled) { return DRAW_DISABLED; - }; + } if (!status.press_attempt && status.hovering) { if (status.pressed) { @@ -273,8 +273,7 @@ BaseButton::DrawMode BaseButton::get_draw_mode() const { return DRAW_HOVER; } else { - /* determine if pressed or not */ - + // Determine if pressed or not. bool pressing; if (status.press_attempt) { pressing = (status.pressing_inside || keep_pressed_outside); @@ -291,8 +290,6 @@ BaseButton::DrawMode BaseButton::get_draw_mode() const { return DRAW_NORMAL; } } - - return DRAW_NORMAL; } void BaseButton::set_toggle_mode(bool p_on) { diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 8bccf3ada1..7ea46a0b4f 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -52,7 +52,7 @@ RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) co } else if (p_item->E->next()) { return p_item->E->next()->get(); } else { - //go up until something with a next is found + // Go up until something with a next is found. while (p_item->parent && !p_item->E->next()) { p_item = p_item->parent; } @@ -72,7 +72,7 @@ RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) co } else if (p_item->E->next()) { return p_item->E->next()->get(); } else { - //go up until something with a next is found + // Go up until something with a next is found. while (p_item->type != ITEM_FRAME && !p_item->E->next()) { p_item = p_item->parent; } @@ -84,8 +84,6 @@ RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) co } } } - - return nullptr; } RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) const { @@ -97,7 +95,7 @@ RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) co } else if (p_item->E->prev()) { return p_item->E->prev()->get(); } else { - //go back until something with a prev is found + // Go back until something with a prev is found. while (p_item->parent && !p_item->E->prev()) { p_item = p_item->parent; } @@ -117,7 +115,7 @@ RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) co } else if (p_item->E->prev()) { return p_item->E->prev()->get(); } else { - //go back until something with a prev is found + // Go back until something with a prev is found. while (p_item->type != ITEM_FRAME && !p_item->E->prev()) { p_item = p_item->parent; } @@ -129,8 +127,6 @@ RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) co } } } - - return nullptr; } Rect2 RichTextLabel::_get_text_rect() { diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index a52bfe97e7..f2ac1c2e58 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -2102,11 +2102,9 @@ bool Animation::track_is_compressed(int p_track) const { return bst->compressed_track >= 0; } break; default: { - return false; //animation does not really use transitions + return false; // Animation does not really use transitions. } break; } - - ERR_FAIL_V(false); } void Animation::track_set_key_value(int p_track, int p_key_idx, const Variant &p_value) { diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index c1e30dd93c..838927e34f 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -3123,8 +3123,6 @@ bool StandardMaterial3D::_set(const StringName &p_name, const Variant &p_value) WARN_PRINT("Godot 3.x SpatialMaterial remapped parameter not found: " + String(p_name)); return true; } - - return false; } #endif // DISABLE_DEPRECATED diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 9138a82ba8..ae83e2136f 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -1537,7 +1537,6 @@ Vector<Point2> TileSet::get_terrain_polygon(int p_terrain_set) { } return _get_half_offset_terrain_polygon(tile_size, overlap, tile_offset_axis); } - return Vector<Point2>(); } Vector<Point2> TileSet::get_terrain_peering_bit_polygon(int p_terrain_set, TileSet::CellNeighbor p_bit) { diff --git a/scene/resources/visual_shader_particle_nodes.cpp b/scene/resources/visual_shader_particle_nodes.cpp index bdfbb59fa6..df6abe161e 100644 --- a/scene/resources/visual_shader_particle_nodes.cpp +++ b/scene/resources/visual_shader_particle_nodes.cpp @@ -1130,31 +1130,38 @@ VisualShaderNodeParticleAccelerator::VisualShaderNodeParticleAccelerator() { // VisualShaderNodeParticleOutput String VisualShaderNodeParticleOutput::get_caption() const { - if (shader_type == VisualShader::TYPE_START) { - return "StartOutput"; - } else if (shader_type == VisualShader::TYPE_PROCESS) { - return "ProcessOutput"; - } else if (shader_type == VisualShader::TYPE_COLLIDE) { - return "CollideOutput"; - } else if (shader_type == VisualShader::TYPE_START_CUSTOM) { - return "CustomStartOutput"; - } else if (shader_type == VisualShader::TYPE_PROCESS_CUSTOM) { - return "CustomProcessOutput"; + switch (shader_type) { + case VisualShader::TYPE_START: + return "StartOutput"; + case VisualShader::TYPE_PROCESS: + return "ProcessOutput"; + case VisualShader::TYPE_COLLIDE: + return "CollideOutput"; + case VisualShader::TYPE_START_CUSTOM: + return "CustomStartOutput"; + case VisualShader::TYPE_PROCESS_CUSTOM: + return "CustomProcessOutput"; + default: + ERR_PRINT(vformat("Unexpected shader_type %d for VisualShaderNodeParticleOutput.", shader_type)); + return ""; } - return String(); } int VisualShaderNodeParticleOutput::get_input_port_count() const { - if (shader_type == VisualShader::TYPE_START) { - return 8; - } else if (shader_type == VisualShader::TYPE_COLLIDE) { - return 5; - } else if (shader_type == VisualShader::TYPE_START_CUSTOM || shader_type == VisualShader::TYPE_PROCESS_CUSTOM) { - return 6; - } else { // TYPE_PROCESS - return 7; + switch (shader_type) { + case VisualShader::TYPE_START: + return 8; + case VisualShader::TYPE_PROCESS: + return 7; + case VisualShader::TYPE_COLLIDE: + return 5; + case VisualShader::TYPE_START_CUSTOM: + case VisualShader::TYPE_PROCESS_CUSTOM: + return 6; + default: + ERR_PRINT(vformat("Unexpected shader_type %d for VisualShaderNodeParticleOutput.", shader_type)); + return 0; } - return 0; } VisualShaderNodeParticleOutput::PortType VisualShaderNodeParticleOutput::get_input_port_type(int p_port) const { |