diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index bf8c11c0ad..f12392ec04 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -500,12 +500,9 @@ namespace Editor for (const auto& parkEntrance : gParkEntrances) { - int32_t x = parkEntrance.x; - int32_t y = parkEntrance.y; - int32_t z = parkEntrance.z / 8; int32_t direction = direction_reverse(parkEntrance.direction); - switch (footpath_is_connected_to_map_edge(x, y, z, direction, 0)) + switch (footpath_is_connected_to_map_edge(parkEntrance, direction, 0)) { case FOOTPATH_SEARCH_NOT_FOUND: gGameCommandErrorText = STR_PARK_ENTRANCE_WRONG_DIRECTION_OR_NO_PATH; @@ -516,7 +513,7 @@ namespace Editor return false; case FOOTPATH_SEARCH_SUCCESS: // Run the search again and unown the path - footpath_is_connected_to_map_edge(x, y, z, direction, (1 << 5)); + footpath_is_connected_to_map_edge(parkEntrance, direction, (1 << 5)); break; } } diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index dc31b476cb..0d3aa846aa 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -1418,10 +1418,12 @@ searchFromFootpath: } } -int32_t footpath_is_connected_to_map_edge(int32_t x, int32_t y, int32_t z, int32_t direction, int32_t flags) +// TODO: Use GAME_COMMAND_FLAGS +int32_t footpath_is_connected_to_map_edge(const CoordsXYZ& footpathPos, int32_t direction, int32_t flags) { flags |= (1 << 0); - return footpath_is_connected_to_map_edge_recurse(x, y, z, direction, flags, 0, 0, 16); + return footpath_is_connected_to_map_edge_recurse( + footpathPos.x, footpathPos.y, footpathPos.z / COORDS_Z_STEP, direction, flags, 0, 0, 16); } bool PathElement::IsSloped() const diff --git a/src/openrct2/world/Footpath.h b/src/openrct2/world/Footpath.h index cd161a7d1a..540ad54ab3 100644 --- a/src/openrct2/world/Footpath.h +++ b/src/openrct2/world/Footpath.h @@ -196,7 +196,7 @@ void footpath_chain_ride_queue( void footpath_update_path_wide_flags(int32_t x, int32_t y); bool footpath_is_blocked_by_vehicle(const TileCoordsXYZ& position); -int32_t footpath_is_connected_to_map_edge(int32_t x, int32_t y, int32_t z, int32_t direction, int32_t flags); +int32_t footpath_is_connected_to_map_edge(const CoordsXYZ& footpathPos, int32_t direction, int32_t flags); void footpath_remove_edges_at(const CoordsXY& footpathPos, TileElement* tileElement); int32_t entrance_get_directions(const TileElement* tileElement);