1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-27 00:34:46 +01:00

Fix wrong vehicle position, nullptr guard

This commit is contained in:
Michał Janiszewski
2016-06-16 23:14:38 +02:00
parent 78e2aec5fe
commit 542828b5d4

View File

@@ -346,8 +346,8 @@ void vehicle_update_sound_params(rct_vehicle* vehicle)
i->id = vehicle->sprite_index;
i->volume = 0;
if (vehicle->x != (sint16)0x8000) {
rct_map_element* map_element = map_get_surface_element_at(vehicle->x, vehicle->y);
if (map_element->base_height * 8 > vehicle->z) { // vehicle underground
rct_map_element* map_element = map_get_surface_element_at(vehicle->x >> 5, vehicle->y >> 5);
if (map_element != NULL && map_element->base_height * 8 > vehicle->z) { // vehicle underground
i->volume = 0x30;
}
}