From a3661e5842df4df22908a817438468fed2a1c878 Mon Sep 17 00:00:00 2001 From: Daniel Trujillo Date: Sat, 9 Jul 2016 01:05:32 +0200 Subject: [PATCH] Swapped if/else at line 5402 Applied De Morgan's laws to simplify condition --- src/ride/vehicle.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ride/vehicle.c b/src/ride/vehicle.c index 6936f8c5cb..df86a77c35 100644 --- a/src/ride/vehicle.c +++ b/src/ride/vehicle.c @@ -5398,8 +5398,18 @@ void apply_block_section_stop_site(rct_vehicle *vehicle, rct_ride *ride){ } else { // If the track piece is a block section stop site if (trackType == TRACK_ELEM_CABLE_LIFT_HILL || trackType == TRACK_ELEM_BLOCK_BRAKES || track_element_is_lift_hill(trackElement)) { - // If the site is NOT in a "train blocking" state - if (!(trackElement->flags & MAP_ELEMENT_FLAG_BLOCK_BREAK_CLOSED) || !ride_is_block_sectioned(ride)) { + // If the site is in a "train blocking" state + if ((trackElement->flags & MAP_ELEMENT_FLAG_BLOCK_BREAK_CLOSED) && ride_is_block_sectioned(ride)) { + // Slow it down till completely stop the car + RCT2_GLOBAL(0x00F64E18, uint32) |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_10; + vehicle->acceleration = 0; + // If the vehicle is slow enough, stop it. If not, slow it down + if (vehicle->velocity <= 0x20000) { + vehicle->velocity = 0; + } else { + vehicle->velocity -= vehicle->velocity >> 3; + } + } else { // If the site is a block brake if (trackType == TRACK_ELEM_BLOCK_BRAKES && vehicle->velocity >= 0) { // If the vehicle is below the speed limit @@ -5413,16 +5423,6 @@ void apply_block_section_stop_site(rct_vehicle *vehicle, rct_ride *ride){ vehicle->acceleration = 0; } } - } else { - // Slow it down till completely stop the car - RCT2_GLOBAL(0x00F64E18, uint32) |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_10; - vehicle->acceleration = 0; - // If the vehicle is slow enough, stop it. If not, slow it down - if (vehicle->velocity <= 0x20000) { - vehicle->velocity = 0; - } else { - vehicle->velocity -= vehicle->velocity >> 3; - } } } }