mirror of https://github.com/OpenRCT2/OpenRCT2.git
Swapped if/else at line 5402
Applied De Morgan's laws to simplify condition
This commit is contained in:
parent
453b33a7b7
commit
a3661e5842
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue