mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix #5939: Crash when importing 'Six Flags Santa Fe'
Protect fix_invalid_vehicle_sprite_sizes from invalid vehicle chains.
This commit is contained in:
parent
6dddd5b76c
commit
eeeebe5525
|
@ -7,6 +7,7 @@
|
|||
- Fix: [#5858] Crash when using custom ride with no colour presets.
|
||||
- Fix: [#5872] Incorrect OpenGL rendering of masked sprites
|
||||
- Fix: [#5920] Placing guest spawn doesn't do anything every 3rd click
|
||||
- Fix: [#5939] Crash when importing 'Six Flags Santa Fe'.
|
||||
- Improved: The land tool buttons can now be held down to increase/decrease size.
|
||||
- Improved: [#5859] OpenGL rendering performance
|
||||
- Improved: [#5863] Switching drawing engines no longer requires the application to restart.
|
||||
|
|
|
@ -8706,13 +8706,13 @@ void fix_invalid_vehicle_sprite_sizes()
|
|||
for (uint16 j = 0; j < MAX_VEHICLES_PER_RIDE; j++) {
|
||||
uint16 rideSpriteIndex = ride->vehicles[j];
|
||||
while (rideSpriteIndex != SPRITE_INDEX_NULL) {
|
||||
rct_vehicle *vehicle = GET_VEHICLE(rideSpriteIndex);
|
||||
rct_ride_entry_vehicle *vehicleEntry = vehicle_get_vehicle_entry(vehicle);
|
||||
rct_vehicle * vehicle = try_get_vehicle(rideSpriteIndex);
|
||||
if (vehicle == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (vehicle == NULL ||
|
||||
vehicleEntry == NULL ||
|
||||
vehicleEntry == (rct_ride_entry_vehicle*)-1)
|
||||
{
|
||||
rct_ride_entry_vehicle * vehicleEntry = vehicle_get_vehicle_entry(vehicle);
|
||||
if (vehicleEntry == NULL || vehicleEntry == (rct_ride_entry_vehicle*)-1) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -657,6 +657,14 @@ static const struct { sint8 x, y, z; } SteamParticleOffsets[] = {
|
|||
{ -8, -4, 17 }
|
||||
};
|
||||
|
||||
rct_vehicle * try_get_vehicle(uint16 spriteIndex)
|
||||
{
|
||||
rct_sprite * sprite = try_get_sprite(spriteIndex);
|
||||
if (sprite == NULL) return NULL;
|
||||
if (sprite->unknown.sprite_identifier != SPRITE_IDENTIFIER_VEHICLE) return NULL;
|
||||
return &sprite->vehicle;
|
||||
}
|
||||
|
||||
static void vehicle_invalidate(rct_vehicle *vehicle)
|
||||
{
|
||||
invalidate_sprite_2((rct_sprite*)vehicle);
|
||||
|
|
|
@ -369,6 +369,7 @@ enum {
|
|||
#define VEHICLE_SEAT_PAIR_FLAG 0x80
|
||||
#define VEHICLE_SEAT_NUM_MASK 0x7F
|
||||
|
||||
rct_vehicle * try_get_vehicle(uint16 spriteIndex);
|
||||
void vehicle_update_all();
|
||||
sint32 sub_6BC2F3(rct_vehicle* vehicle);
|
||||
void vehicle_sounds_update();
|
||||
|
|
Loading…
Reference in New Issue