diff --git a/distribution/changelog.txt b/distribution/changelog.txt index b41c9335e9..f06f8da6dd 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -13,6 +13,7 @@ - Fix: [#6006] Objects higher than 6 metres are considered trees (original bug). - Fix: [#7884] Unfinished preserved rides can be demolished with quick demolish. - Fix: [#7913] RCT1/RCT2 title sequence timing is off. +- Fix: [#7700, #8079, #8969] Crash when unloading buggy custom rides. - Fix: [#8219] Faulty folder recreation in "save" folder. - Fix: [#8537] Imported RCT1 rides/shops are all numbered 1. - Fix: [#8649] Setting date does not work in multiplayer. diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 197a4cec26..c3d40e78d9 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -4028,22 +4028,32 @@ void Guest::UpdateRideLeaveVehicle() platformLocation.x = vehicle->x + word_981D6C[platformLocation.direction].x * 12; platformLocation.y = vehicle->y + word_981D6C[platformLocation.direction].y * 12; - int8_t loadPosition = vehicle_entry->peep_loading_positions[current_seat]; - - switch (vehicle->sprite_direction / 8) + // This can evaluate to false with buggy custom rides. + if (current_seat < vehicle_entry->peep_loading_positions.size()) { - case 0: - platformLocation.x -= loadPosition; - break; - case 1: - platformLocation.y += loadPosition; - break; - case 2: - platformLocation.x += loadPosition; - break; - case 3: - platformLocation.y -= loadPosition; - break; + int8_t loadPosition = vehicle_entry->peep_loading_positions[current_seat]; + + switch (vehicle->sprite_direction / 8) + { + case 0: + platformLocation.x -= loadPosition; + break; + case 1: + platformLocation.y += loadPosition; + break; + case 2: + platformLocation.x += loadPosition; + break; + case 3: + platformLocation.y -= loadPosition; + break; + } + } + else + { + log_verbose( + "current_seat %d is too large! (Vehicle entry has room for %d.)", current_seat, + vehicle_entry->peep_loading_positions.size()); } platformLocation.z = ride->stations[current_ride_station].Height * 8;