forked from rosebudai/OpenRCT2-Web
Add method to check if brakes should fail (#25909)
This commit is contained in:
1 parent
4c4b9f3922
commit
80d1486cd5
4 files changed
+9
-11
No files matched your search
@@ -953,6 +953,12 @@ bool Ride::supportsStatus(RideStatus s) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Ride::hasFailingBrakes() const
|
||||
{
|
||||
return lifecycleFlags & RIDE_LIFECYCLE_BROKEN_DOWN && breakdownReasonPending == BREAKDOWN_BRAKES_FAILURE
|
||||
&& mechanicStatus != MechanicStatus::hasFixedStationBrakes;
|
||||
}
|
||||
|
||||
#pragma region Initialisation functions
|
||||
|
||||
/**
|
||||
|
||||
@@ -408,6 +408,7 @@ public:
|
||||
bool isBlockSectioned() const;
|
||||
bool canHaveMultipleCircuits() const;
|
||||
bool supportsStatus(RideStatus s) const;
|
||||
bool hasFailingBrakes() const;
|
||||
|
||||
void stopGuestsQueuing();
|
||||
void validateStations();
|
||||
|
||||
@@ -1604,7 +1604,6 @@ void Vehicle::UpdateArriving()
|
||||
if (curRide == nullptr)
|
||||
return;
|
||||
|
||||
bool stationBrakesWork = true;
|
||||
uint32_t curFlags = 0;
|
||||
|
||||
switch (curRide->mode)
|
||||
@@ -1637,13 +1636,7 @@ void Vehicle::UpdateArriving()
|
||||
}
|
||||
}
|
||||
|
||||
bool hasBrakesFailure = curRide->lifecycleFlags & RIDE_LIFECYCLE_BROKEN_DOWN
|
||||
&& curRide->breakdownReasonPending == BREAKDOWN_BRAKES_FAILURE;
|
||||
if (hasBrakesFailure && curRide->inspectionStation == current_station
|
||||
&& curRide->mechanicStatus != MechanicStatus::hasFixedStationBrakes)
|
||||
{
|
||||
stationBrakesWork = false;
|
||||
}
|
||||
auto stationBrakesWork = !curRide->hasFailingBrakes();
|
||||
|
||||
const auto* rideEntry = GetRideEntry();
|
||||
const auto& carEntry = rideEntry->Cars[vehicle_type];
|
||||
|
||||
@@ -795,9 +795,7 @@ bool Vehicle::UpdateTrackMotionForwards(const CarEntry* carEntry, const Ride& cu
|
||||
}
|
||||
else if (TrackTypeIsBrakes(trackType))
|
||||
{
|
||||
bool hasBrakesFailure = curRide.lifecycleFlags & RIDE_LIFECYCLE_BROKEN_DOWN
|
||||
&& curRide.breakdownReasonPending == BREAKDOWN_BRAKES_FAILURE;
|
||||
if (!hasBrakesFailure || curRide.mechanicStatus == MechanicStatus::hasFixedStationBrakes)
|
||||
if (!curRide.hasFailingBrakes())
|
||||
{
|
||||
auto brakeSpeed = ChooseBrakeSpeed() << kTrackSpeedShiftAmount;
|
||||
|
||||
|
||||
Reference in new issue
Block a user