Remove gotos from TrackMotionForwardsGetNewTrack (#11955)

* Remove gotos from TrackMotionForwardsGetNewTrack

* Move default case to the bottom of the switch

Co-authored-by: Michael Steenbeek <m.o.steenbeek@gmail.com>
This commit is contained in:
Hudson Oliveira 2020-06-14 20:25:13 -03:00 committed by GitHub
parent 1e5739b739
commit feb3fcfd6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 50 additions and 49 deletions

View File

@ -7996,26 +7996,28 @@ bool Vehicle::UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, Ride* cur
// Change from original: this used to check if the vehicle allowed doors.
vehicle_update_scenery_door(this);
bool isGoingBack = false;
switch (TrackSubposition)
{
default:
goto loc_6DB358;
case VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_BACK:
case VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_END_BULLWHEEL:
TrackSubposition = VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_BACK;
goto loc_6DB32A;
isGoingBack = true;
break;
case VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_START_BULLWHEEL:
TrackSubposition = VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_OUT;
goto loc_6DB358;
break;
case VEHICLE_TRACK_SUBPOSITION_GO_KARTS_MOVING_TO_RIGHT_LANE:
TrackSubposition = VEHICLE_TRACK_SUBPOSITION_GO_KARTS_RIGHT_LANE;
goto loc_6DB358;
break;
case VEHICLE_TRACK_SUBPOSITION_GO_KARTS_MOVING_TO_LEFT_LANE:
TrackSubposition = VEHICLE_TRACK_SUBPOSITION_GO_KARTS_LEFT_LANE;
goto loc_6DB358;
break;
default:
break;
}
loc_6DB32A:
if (isGoingBack)
{
track_begin_end trackBeginEnd;
if (!track_block_get_previous({ TrackLocation, tileElement }, &trackBeginEnd))
@ -8028,9 +8030,8 @@ loc_6DB32A:
location.direction = trackBeginEnd.begin_direction;
tileElement = trackBeginEnd.begin_element;
}
goto loc_6DB41D;
loc_6DB358:
else
{
{
int32_t curZ, direction;
CoordsXYE xyElement = { TrackLocation, tileElement };
@ -8067,8 +8068,8 @@ loc_6DB358:
}
}
}
}
loc_6DB41D:
TrackLocation = location;
// TODO check if getting the vehicle entry again is necessary