From ceb77b489d34d89bc0f243e9ce078efa55b757af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Mon, 23 Jan 2017 23:07:12 +0100 Subject: [PATCH] Fix map_get_path_element_at to not consider ghosts --- src/openrct2/peep/peep.c | 6 +++--- src/openrct2/world/map.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/openrct2/peep/peep.c b/src/openrct2/peep/peep.c index 901f96cddb..fac35decde 100644 --- a/src/openrct2/peep/peep.c +++ b/src/openrct2/peep/peep.c @@ -5399,7 +5399,7 @@ static sint32 peep_update_walking_find_bench(rct_peep* peep){ rct_map_element* map_element = map_get_first_element_at(peep->next_x / 32, peep->next_y / 32); for (;; map_element++){ - if (!(map_element->flags & MAP_ELEMENT_FLAG_GHOST) && (map_element_get_type(map_element) == MAP_ELEMENT_TYPE_PATH)) { + if (map_element_get_type(map_element) == MAP_ELEMENT_TYPE_PATH) { if (peep->next_z == map_element->base_height)break; } if (map_element_is_last_for_tile(map_element)){ @@ -10109,7 +10109,7 @@ static sint32 guest_path_finding(rct_peep* peep) z = peep->next_z; rct_map_element *mapElement = map_get_path_element_at(x / 32, y / 32, z); - if (mapElement == NULL || (mapElement->flags & MAP_ELEMENT_FLAG_GHOST)) { + if (mapElement == NULL) { return 1; } @@ -10420,7 +10420,7 @@ static sint32 sub_693C9E(rct_peep *peep) continue; if (top_z < mapElement->base_height) continue; - if ((mapElement->flags & MAP_ELEMENT_FLAG_GHOST)) + if (mapElement->flags & MAP_ELEMENT_FLAG_GHOST) continue; if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_PATH){ diff --git a/src/openrct2/world/map.c b/src/openrct2/world/map.c index 9a9e0deec0..99802ad9b1 100644 --- a/src/openrct2/world/map.c +++ b/src/openrct2/world/map.c @@ -330,6 +330,8 @@ rct_map_element* map_get_path_element_at(sint32 x, sint32 y, sint32 z){ // Find the path element at known z do { + if (mapElement->flags & MAP_ELEMENT_FLAG_GHOST) + continue; if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_PATH) continue; if (mapElement->base_height != z)