Merge pull request #11648 from Gymnasiast/block-brake-constant

Create constant for BLOCK_BRAKE_BASE_SPEED
This commit is contained in:
Michael Steenbeek 2020-05-05 18:12:01 +02:00 committed by GitHub
commit 6b591c6c75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -15,6 +15,8 @@
constexpr const uint16_t RideConstructionSpecialPieceSelected = 0x100;
constexpr const int32_t BLOCK_BRAKE_BASE_SPEED = 0x20364;
using track_type_t = uint16_t;
#pragma pack(push, 1)

View File

@ -6621,18 +6621,18 @@ void Vehicle::UpdateTrackMotionUpStopCheck() const
* merely as a velocity regulator, in a closed state. When the brake is open, it
* boosts the train to the speed limit
*/
static void apply_non_stop_block_brake(Vehicle* vehicle, bool block_brake_closed)
static void apply_non_stop_block_brake(Vehicle* vehicle, bool slowDownToBlockBrakeSpeed)
{
if (vehicle->velocity >= 0)
{
// If the vehicle is below the speed limit
if (vehicle->velocity <= 0x20364)
if (vehicle->velocity <= BLOCK_BRAKE_BASE_SPEED)
{
// Boost it to the fixed block brake speed
vehicle->velocity = 0x20364;
vehicle->velocity = BLOCK_BRAKE_BASE_SPEED;
vehicle->acceleration = 0;
}
else if (block_brake_closed)
else if (slowDownToBlockBrakeSpeed)
{
// Slow it down till the fixed block brake speed
vehicle->velocity -= vehicle->velocity >> 4;
@ -7587,7 +7587,7 @@ static void vehicle_update_handle_scenery_door(Vehicle* vehicle)
static void vehicle_update_play_water_splash_sound()
{
if (_vehicleVelocityF64E08 <= 0x20364)
if (_vehicleVelocityF64E08 <= BLOCK_BRAKE_BASE_SPEED)
{
return;
}