Fix #19911: Guests stuck at railway crossings (#19939)

In continuous circuit operating mode, not only the train head should be used for (un)blocking path. Because of this change, a previous change regarding which trailing track blocks should be unblocked has been reverted, as to prevent path being unblocked too soon.
This commit is contained in:
Rik Smeets 2023-04-20 18:53:21 +02:00 committed by GitHub
parent e614584f65
commit d10be6d0e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 14 deletions

View File

@ -24,6 +24,7 @@
- Fix: [#19854] Looping Coaster trains clipping through steep quarter turns down.
- Fix: [#19858] Issue drawing simulate flag icon on alternate colour palettes.
- Fix: [#19901] Random shop colours never assigning last colour.
- Fix: [#19911] Guests stuck at certain railway crossings.
- Fix: [#19924] Destructible cheat does not allow partial ride modification.
- Fix: [#19950] Mine train block brake supports drawn incorrectly.
- Fix: [#19987] [Plugin] SetCheatAction has wrong ID in plugin API.

View File

@ -9213,7 +9213,22 @@ void Vehicle::InvalidateWindow()
void Vehicle::UpdateCrossings() const
{
if (TrainHead() != this)
auto curRide = GetRide();
if (curRide == nullptr)
{
return;
}
// Parks may have rides hacked into the path.
// Limit path blocking to rides actually supporting level crossings to prevent peeps getting stuck everywhere.
if (!GetRideTypeDescriptor(curRide->type).HasFlag(RIDE_TYPE_FLAG_SUPPORTS_LEVEL_CROSSINGS))
{
return;
}
// In shuttle mode, only the train head is considered to be travelling backwards
// To prevent path getting blocked incorrectly, only update crossings when this is the train head
if (curRide->mode == RideMode::Shuttle && TrainHead() != this)
{
return;
}
@ -9257,12 +9272,7 @@ void Vehicle::UpdateCrossings() const
while (true)
{
auto* pathElement = MapGetPathElementAt(TileCoordsXYZ(CoordsXYZ{ xyElement, xyElement.element->GetBaseZ() }));
auto curRide = GetRide();
// Many New Element parks have invisible rides hacked into the path.
// Limit path blocking to rides actually supporting level crossings to prevent peeps getting stuck everywhere.
if (pathElement != nullptr && curRide != nullptr
&& GetRideTypeDescriptor(curRide->type).HasFlag(RIDE_TYPE_FLAG_SUPPORTS_LEVEL_CROSSINGS))
if (pathElement != nullptr)
{
if (!playedClaxon && !pathElement->IsBlockedByVehicle())
{
@ -9321,18 +9331,21 @@ void Vehicle::UpdateCrossings() const
uint8_t freeCount = travellingForwards && status != Vehicle::Status::Departing ? 3 : 1;
while (freeCount-- > 0)
{
if (travellingForwards)
{
if (TrackBlockGetPrevious(xyElement, &output))
{
xyElement.x = output.begin_x;
xyElement.y = output.begin_y;
xyElement.element = output.begin_element;
}
}
auto* pathElement = MapGetPathElementAt(TileCoordsXYZ(CoordsXYZ{ xyElement, xyElement.element->GetBaseZ() }));
if (pathElement != nullptr)
{
pathElement->SetIsBlockedByVehicle(false);
}
if (travellingForwards && freeCount > 0 && TrackBlockGetPrevious(xyElement, &output))
{
xyElement.x = output.begin_x;
xyElement.y = output.begin_y;
xyElement.element = output.begin_element;
}
}
}