From f9307c8c9e98cb15849f60ab081bb12f7fc178d6 Mon Sep 17 00:00:00 2001 From: Hielke Morsink Date: Fri, 16 Mar 2018 16:45:54 +0100 Subject: [PATCH] Proplerly check for element to be removed The element that gets removed is only a ghost while using the path tool, other tools just remove the path immediately. --- src/openrct2/world/Footpath.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 62e5aa6f47..b669c158f1 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -2250,12 +2250,13 @@ static void footpath_remove_edges_towards(sint32 x, sint32 y, sint32 z0, sint32 // Returns true when there is an element at the given coordinates that want to connect to a path with the given direction (ride // entrances and exits, shops, paths). -static bool tile_element_wants_path_connection_towards(TileCoordsXYZD coords) +static bool tile_element_wants_path_connection_towards(TileCoordsXYZD coords, const rct_tile_element * const elementToBeRemoved) { rct_tile_element * tileElement = map_get_first_element_at(coords.x, coords.y); do { - if (tile_element_is_ghost(tileElement)) + // Don't check the element that gets removed + if (tileElement == elementToBeRemoved) continue; switch (tile_element_get_type(tileElement)) @@ -2385,7 +2386,7 @@ void footpath_remove_edges_at(sint32 x, sint32 y, rct_tile_element *tileElement) // When clearance checks were disabled a neighbouring path can be connected to both the path-ghost and to something // else, so before removing edges from neighbouring paths we have to make sure there is nothing else they are connected // to. - if (!tile_element_wants_path_connection_towards({ x / 32, y / 32, z1, direction })) + if (!tile_element_wants_path_connection_towards({ x / 32, y / 32, z1, direction }, tileElement)) { sint32 z0 = z1 - 2; footpath_remove_edges_towards(