Fix #4920: Crash in peep pathfinding

This commit is contained in:
Michał Janiszewski 2016-12-26 15:53:11 +01:00 committed by Ted John
parent e25734819b
commit ac32e7dd08
2 changed files with 6 additions and 0 deletions

View File

@ -851,6 +851,8 @@ bool fence_in_the_way(int x, int y, int z0, int z1, int direction)
rct_map_element *mapElement;
mapElement = map_get_first_element_at(x >> 5, y >> 5);
if (mapElement == NULL)
return false;
do {
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_FENCE)
continue;

View File

@ -5146,6 +5146,10 @@ bool map_surface_is_blocked(sint16 x, sint16 y){
mapElement = map_get_surface_element_at(x / 32, y / 32);
if (mapElement == NULL) {
return true;
}
sint16 water_height = mapElement->properties.surface.terrain & MAP_ELEMENT_WATER_HEIGHT_MASK;
water_height *= 2;
if (water_height > mapElement->base_height)