Fix #4714. Prevent invalid peep access on closed golf rides.

When a golf ride is closed it will remove the peep from the vehicle (the ball). Due to the way vehicles leave stations the vehicle would still travel to the next hole but when it tried to update the peeps action it would crash. This skips updating the peeps action but lets the ball still continue. This will cause a phantom ball to go around the golf course until all the vehicles are back in their closed state.
This commit is contained in:
duncanspumpkin 2016-11-09 19:00:09 +00:00
parent 4662b648d2
commit 2f6f728200
1 changed files with 14 additions and 9 deletions

View File

@ -8139,16 +8139,21 @@ loc_6DC743:
break;
case 4: // loc_6DC820
z = moveInfo->z;
if (z == 2) {
rct_peep *peep = GET_PEEP(vehicle->peep[0]);
if (peep->id & 7) {
z = 7;
// When the ride is closed occasionally the peep is removed
// but the vehicle is still on the track. This will prevent
// it from crashing in that situation.
if (vehicle->peep[0]) {
if (z == 2) {
rct_peep *peep = GET_PEEP(vehicle->peep[0]);
if (peep->id & 7) {
z = 7;
}
}
}
if (z == 6) {
rct_peep *peep = GET_PEEP(vehicle->peep[0]);
if (peep->id & 7) {
z = 8;
if (z == 6) {
rct_peep *peep = GET_PEEP(vehicle->peep[0]);
if (peep->id & 7) {
z = 8;
}
}
}
vehicle->mini_golf_current_animation = (uint8)z;