1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Fix #15819: Potential crash placing a maze design

This commit is contained in:
ζeh Matt
2021-11-02 01:31:21 -07:00
committed by GitHub
parent af78bbb448
commit 8158956f18

View File

@@ -1525,21 +1525,23 @@ void Ride::ValidateStations()
continue;
auto trackType = trackElement->AsTrack()->GetTrackType();
uint8_t trackSequence = trackElement->AsTrack()->GetSequenceIndex();
// determine where the ride entrance is relative to the station track
Direction direction = (tileElement->GetDirection() - direction_reverse(trackElement->GetDirection())) & 3;
// if the ride entrance is not on a valid side, remove it
ted = &GetTrackElementDescriptor(trackType);
if (!(ted->SequenceProperties[trackSequence] & (1 << direction)))
{
continue;
}
// get the StationIndex for the station
StationIndex stationId = 0;
if (trackType != TrackElemType::Maze)
{
uint8_t trackSequence = trackElement->AsTrack()->GetSequenceIndex();
// determine where the ride entrance is relative to the station track
Direction direction = (tileElement->GetDirection() - direction_reverse(trackElement->GetDirection())) & 3;
// if the ride entrance is not on a valid side, remove it
ted = &GetTrackElementDescriptor(trackType);
if (!(ted->SequenceProperties[trackSequence] & (1 << direction)))
{
continue;
}
stationId = trackElement->AsTrack()->GetStationIndex();
}
if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_EXIT)