From 5ef5e4153d4b25fc4891bc6e473b353dfff79096 Mon Sep 17 00:00:00 2001 From: Hielke Morsink Date: Fri, 4 Jan 2019 22:26:56 +0100 Subject: [PATCH] Fix some more implicit and conditional fallthroughs --- src/openrct2-ui/input/MouseInput.cpp | 2 ++ src/openrct2-ui/windows/TopToolbar.cpp | 2 +- src/openrct2/peep/GuestPathfinding.cpp | 14 +++++--------- src/openrct2/ride/Track.cpp | 6 +++--- src/openrct2/ride/Vehicle.cpp | 6 +++--- src/openrct2/ride/gentle/Dodgems.cpp | 4 ++-- src/openrct2/world/Map.cpp | 3 +-- 7 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp index 93038bfd52..6563387b7a 100644 --- a/src/openrct2-ui/input/MouseInput.cpp +++ b/src/openrct2-ui/input/MouseInput.cpp @@ -1365,6 +1365,8 @@ void input_state_widget_pressed( widget_invalidate_by_number(cursor_w_class, cursor_w_number, widgetIndex); window_event_mouse_up_call(w, widgetIndex); + return; + default: return; } diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index b3f474f740..f11f255355 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -767,7 +767,7 @@ static void window_top_toolbar_invalidate(rct_window* w) break; case NETWORK_MODE_CLIENT: window_top_toolbar_widgets[WIDX_PAUSE].type = WWT_EMPTY; - // Fall-through + [[fallthrough]]; case NETWORK_MODE_SERVER: window_top_toolbar_widgets[WIDX_FASTFORWARD].type = WWT_EMPTY; break; diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index 03b3b971a2..a9b70aa450 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -657,16 +657,12 @@ static void peep_pathfind_heuristic_search( * tile. */ rideIndex = tileElement->AsTrack()->GetRideIndex(); Ride* ride = get_ride(rideIndex); - if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IS_SHOP)) - { - found = true; - searchResult = PATH_SEARCH_SHOP_ENTRANCE; - break; - } - else - { + if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IS_SHOP)) continue; - } + + found = true; + searchResult = PATH_SEARCH_SHOP_ENTRANCE; + break; } case TILE_ELEMENT_TYPE_ENTRANCE: if (loc.z != tileElement->base_height) diff --git a/src/openrct2/ride/Track.cpp b/src/openrct2/ride/Track.cpp index aa7c5358e9..d42d7dba90 100644 --- a/src/openrct2/ride/Track.cpp +++ b/src/openrct2/ride/Track.cpp @@ -1417,7 +1417,7 @@ static money32 track_place( case TRACK_ELEM_DIAG_60_DEG_UP_TO_FLAT: if (!(liftHillAndAlternativeState & CONSTRUCTION_LIFT_HILL_SELECTED)) break; - // Fall Through + [[fallthrough]]; case TRACK_ELEM_CABLE_LIFT_HILL: ride->num_block_brakes++; break; @@ -1833,7 +1833,7 @@ static money32 track_remove( case TRACK_ELEM_DIAG_60_DEG_UP_TO_FLAT: if (!isLiftHill) break; - // Fall through + [[fallthrough]]; case TRACK_ELEM_CABLE_LIFT_HILL: ride->num_block_brakes--; break; @@ -2372,4 +2372,4 @@ void TrackElement::SetHighlight(bool on) type &= ~TILE_ELEMENT_TYPE_FLAG_HIGHLIGHT; if (on) type |= TILE_ELEMENT_TYPE_FLAG_HIGHLIGHT; -} \ No newline at end of file +} diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 85c396b28f..e10b12fbb8 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -3277,7 +3277,7 @@ static void vehicle_update_departing(rct_vehicle* vehicle) vehicle->acceleration = 14 << 12; break; } - // Fall through + [[fallthrough]]; case RIDE_MODE_CONTINUOUS_CIRCUIT: case RIDE_MODE_CONTINUOUS_CIRCUIT_BLOCK_SECTIONED: case RIDE_MODE_ROTATING_LIFT: @@ -7162,7 +7162,7 @@ static void vehicle_update_spinning_car(rct_vehicle* vehicle) vehicle->spin_speed -= dword_F64E08 >> spinningInertia; break; } - // Fall through + [[fallthrough]]; case L9_SPIN: spinningInertia += 9; vehicle->spin_speed += dword_F64E08 >> spinningInertia; @@ -7189,7 +7189,7 @@ static void vehicle_update_spinning_car(rct_vehicle* vehicle) vehicle->spin_speed += dword_F64E08 >> spinningInertia; break; } - // Fall through + [[fallthrough]]; case R9_SPIN: spinningInertia += 9; vehicle->spin_speed -= dword_F64E08 >> spinningInertia; diff --git a/src/openrct2/ride/gentle/Dodgems.cpp b/src/openrct2/ride/gentle/Dodgems.cpp index 88404624b5..b790d6c353 100644 --- a/src/openrct2/ride/gentle/Dodgems.cpp +++ b/src/openrct2/ride/gentle/Dodgems.cpp @@ -59,7 +59,7 @@ static void paint_dodgems( { case 2: trackSequence = 15 - trackSequence; - // Fallthrough + [[fallthrough]]; case 0: if ((trackSequence / 4) & 1) { @@ -73,7 +73,7 @@ static void paint_dodgems( case 3: trackSequence = 15 - trackSequence; - // Fallthrough + [[fallthrough]]; case 1: if ((trackSequence / 4) & 1) { diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 7421f4fd70..1059523993 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -3134,8 +3134,7 @@ void map_remove_all_rides() case TILE_ELEMENT_TYPE_ENTRANCE: if (it.element->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE) break; - - // fall-through + [[fallthrough]]; case TILE_ELEMENT_TYPE_TRACK: footpath_queue_chain_reset(); footpath_remove_edges_at(it.x * 32, it.y * 32, it.element);