From b1dc6ed6edad428304996e586c2192cb1f700c66 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 4 Jan 2020 07:31:02 -0300 Subject: [PATCH] Use CoordsXY on footpath_connect_edges() --- src/openrct2/actions/FootpathPlaceAction.hpp | 2 +- src/openrct2/actions/PlaceParkEntranceAction.hpp | 2 +- src/openrct2/actions/RideEntranceExitPlaceAction.hpp | 2 +- src/openrct2/actions/TrackPlaceAction.hpp | 2 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/ride/TrackDesign.cpp | 2 +- src/openrct2/world/Footpath.cpp | 10 +++++----- src/openrct2/world/Footpath.h | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/openrct2/actions/FootpathPlaceAction.hpp b/src/openrct2/actions/FootpathPlaceAction.hpp index 67eeb5df84..1777b61f16 100644 --- a/src/openrct2/actions/FootpathPlaceAction.hpp +++ b/src/openrct2/actions/FootpathPlaceAction.hpp @@ -426,7 +426,7 @@ private: } if (!(GetFlags() & GAME_COMMAND_FLAG_PATH_SCENERY)) - footpath_connect_edges(_loc.x, _loc.y, (TileElement*)pathElement, GetFlags()); + footpath_connect_edges(_loc, reinterpret_cast(pathElement), GetFlags()); footpath_update_queue_chains(); map_invalidate_tile_full(_loc); diff --git a/src/openrct2/actions/PlaceParkEntranceAction.hpp b/src/openrct2/actions/PlaceParkEntranceAction.hpp index b903a84327..6699782ff7 100644 --- a/src/openrct2/actions/PlaceParkEntranceAction.hpp +++ b/src/openrct2/actions/PlaceParkEntranceAction.hpp @@ -171,7 +171,7 @@ public: if (!(flags & GAME_COMMAND_FLAG_GHOST)) { - footpath_connect_edges(entranceLoc.x, entranceLoc.y, newElement, 1); + footpath_connect_edges(entranceLoc, newElement, GAME_COMMAND_FLAG_APPLY); } update_park_fences(entranceLoc); diff --git a/src/openrct2/actions/RideEntranceExitPlaceAction.hpp b/src/openrct2/actions/RideEntranceExitPlaceAction.hpp index 5072bc8eda..6af2a3cd6e 100644 --- a/src/openrct2/actions/RideEntranceExitPlaceAction.hpp +++ b/src/openrct2/actions/RideEntranceExitPlaceAction.hpp @@ -224,7 +224,7 @@ public: maze_entrance_hedge_removal(_loc.x, _loc.y, tileElement); } - footpath_connect_edges(_loc.x, _loc.y, tileElement, GetFlags()); + footpath_connect_edges(_loc, tileElement, GetFlags()); footpath_update_queue_chains(); map_invalidate_tile_full(_loc); diff --git a/src/openrct2/actions/TrackPlaceAction.hpp b/src/openrct2/actions/TrackPlaceAction.hpp index 36fa46ddd1..9ed8f1b507 100644 --- a/src/openrct2/actions/TrackPlaceAction.hpp +++ b/src/openrct2/actions/TrackPlaceAction.hpp @@ -676,7 +676,7 @@ public: if (!gCheatsDisableClearanceChecks || !(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { - footpath_connect_edges(mapLoc.x, mapLoc.y, tileElement, GetFlags()); + footpath_connect_edges(mapLoc, tileElement, GetFlags()); } map_invalidate_tile_full(mapLoc); } diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 70fdf3d7bc..2764d8260d 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -3001,7 +3001,7 @@ private: // Trigger footpath update footpath_queue_chain_reset(); footpath_connect_edges( - entranceCoords.x * 32, (entranceCoords.y) * 32, (TileElement*)entranceElement, + entranceCoords.ToCoordsXY(), reinterpret_cast(entranceElement), GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED); footpath_update_queue_chains(); } diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index eee7fbbba6..a8ed22297c 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -1205,7 +1205,7 @@ static bool TrackDesignPlaceSceneryElement( | GAME_COMMAND_FLAG_GHOST; } - footpath_connect_edges(mapCoord.x, mapCoord.y, reinterpret_cast(pathElement), flags); + footpath_connect_edges(mapCoord, reinterpret_cast(pathElement), flags); footpath_update_queue_chains(); return true; } diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 2d42a5b897..fae2c5e943 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -987,7 +987,7 @@ static void loc_6A6C85( * * rct2: 0x006A6C66 */ -void footpath_connect_edges(int32_t x, int32_t y, TileElement* tileElement, int32_t flags) +void footpath_connect_edges(const CoordsXY& footpathPos, TileElement* tileElement, int32_t flags) { rct_neighbour_list neighbourList; rct_neighbour neighbour; @@ -996,10 +996,10 @@ void footpath_connect_edges(int32_t x, int32_t y, TileElement* tileElement, int3 neighbour_list_init(&neighbourList); - footpath_update_queue_entrance_banner(x, y, tileElement); + footpath_update_queue_entrance_banner(footpathPos.x, footpathPos.y, tileElement); for (Direction direction : ALL_DIRECTIONS) { - loc_6A6C85(x, y, direction, tileElement, flags, true, &neighbourList); + loc_6A6C85(footpathPos.x, footpathPos.y, direction, tileElement, flags, true, &neighbourList); } neighbour_list_sort(&neighbourList); @@ -1035,12 +1035,12 @@ void footpath_connect_edges(int32_t x, int32_t y, TileElement* tileElement, int3 while (neighbour_list_pop(&neighbourList, &neighbour)) { - loc_6A6C85(x, y, neighbour.direction, tileElement, flags, false, nullptr); + loc_6A6C85(footpathPos.x, footpathPos.y, neighbour.direction, tileElement, flags, false, nullptr); } if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH) { - footpath_connect_corners(x, y, tileElement); + footpath_connect_corners(footpathPos.x, footpathPos.y, tileElement); } } diff --git a/src/openrct2/world/Footpath.h b/src/openrct2/world/Footpath.h index 8d4eabc7cd..383dd102a9 100644 --- a/src/openrct2/world/Footpath.h +++ b/src/openrct2/world/Footpath.h @@ -187,7 +187,7 @@ void footpath_get_coordinates_from_pos( void footpath_bridge_get_info_from_pos( ScreenCoordsXY screenCoords, int32_t* x, int32_t* y, int32_t* direction, TileElement** tileElement); void footpath_remove_litter(int32_t x, int32_t y, int32_t z); -void footpath_connect_edges(int32_t x, int32_t y, TileElement* tileElement, int32_t flags); +void footpath_connect_edges(const CoordsXY& footpathPos, TileElement* tileElement, int32_t flags); void footpath_update_queue_chains(); bool fence_in_the_way(int32_t x, int32_t y, int32_t z0, int32_t z1, int32_t direction); void footpath_chain_ride_queue(