diff --git a/src/openrct2/entity/Staff.cpp b/src/openrct2/entity/Staff.cpp index 0764208cd6..7415989291 100644 --- a/src/openrct2/entity/Staff.cpp +++ b/src/openrct2/entity/Staff.cpp @@ -46,6 +46,7 @@ #include "../world/Footpath.h" #include "../world/Map.h" #include "../world/Scenery.h" +#include "../world/Wall.h" #include "../world/tile_element/EntranceElement.h" #include "../world/tile_element/PathElement.h" #include "../world/tile_element/Slope.h" diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index 6c15746a21..e8c3e2c534 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -22,6 +22,7 @@ #include "../world/Entrance.h" #include "../world/Footpath.h" #include "../world/Map.h" +#include "../world/Wall.h" #include "../world/tile_element/BannerElement.h" #include "../world/tile_element/EntranceElement.h" #include "../world/tile_element/PathElement.h" diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index e1a2d430a9..34b51d2e9d 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -36,6 +36,7 @@ #include "Location.hpp" #include "Map.h" #include "MapAnimation.h" +#include "Wall.h" #include "tile_element/BannerElement.h" #include "tile_element/EntranceElement.h" #include "tile_element/PathElement.h" @@ -185,39 +186,6 @@ void FootpathInterruptPeeps(const CoordsXYZ& footpathPos) } } -/** - * Returns true if the edge of tile x, y specified by direction is occupied by a fence - * between heights z0 and z1. - * - * Note that there may still be a fence on the opposing tile. - * - * rct2: 0x006E59DC - */ -bool WallInTheWay(const CoordsXYRangedZ& fencePos, int32_t direction) -{ - TileElement* tileElement; - - tileElement = MapGetFirstElementAt(fencePos); - if (tileElement == nullptr) - return false; - do - { - if (tileElement->GetType() != TileElementType::Wall) - continue; - if (tileElement->IsGhost()) - continue; - if (fencePos.baseZ >= tileElement->GetClearanceZ()) - continue; - if (fencePos.clearanceZ <= tileElement->GetBaseZ()) - continue; - if ((tileElement->GetDirection()) != direction) - continue; - - return true; - } while (!(tileElement++)->IsLastForTile()); - return false; -} - static PathElement* FootpathConnectCornersGetNeighbour(const CoordsXYZ& footpathPos, int32_t requireEdges) { if (!MapIsLocationValid(footpathPos)) diff --git a/src/openrct2/world/Footpath.h b/src/openrct2/world/Footpath.h index c96f9b744f..9140d65399 100644 --- a/src/openrct2/world/Footpath.h +++ b/src/openrct2/world/Footpath.h @@ -148,7 +148,6 @@ void FootpathInterruptPeeps(const CoordsXYZ& footpathPos); void FootpathRemoveLitter(const CoordsXYZ& footpathPos); void FootpathConnectEdges(const CoordsXY& footpathPos, OpenRCT2::TileElement* tileElement, int32_t flags); void FootpathUpdateQueueChains(); -bool WallInTheWay(const CoordsXYRangedZ& fencePos, int32_t direction); void FootpathChainRideQueue( RideId rideIndex, StationIndex entranceIndex, const CoordsXY& footpathPos, OpenRCT2::TileElement* tileElement, int32_t direction); diff --git a/src/openrct2/world/Wall.cpp b/src/openrct2/world/Wall.cpp index a4723948fd..a37edc2405 100644 --- a/src/openrct2/world/Wall.cpp +++ b/src/openrct2/world/Wall.cpp @@ -114,3 +114,36 @@ uint8_t GetWallSlopeFromEdgeSlope(uint8_t Slope, uint8_t Edge) { return kLandSlopeToWallSlope[Slope][Edge]; } + +/** + * Returns true if the edge of tile x, y specified by direction is occupied by a fence + * between heights z0 and z1. + * + * Note that there may still be a fence on the opposing tile. + * + * rct2: 0x006E59DC + */ +bool WallInTheWay(const CoordsXYRangedZ& fencePos, int32_t direction) +{ + TileElement* tileElement; + + tileElement = MapGetFirstElementAt(fencePos); + if (tileElement == nullptr) + return false; + do + { + if (tileElement->GetType() != TileElementType::Wall) + continue; + if (tileElement->IsGhost()) + continue; + if (fencePos.baseZ >= tileElement->GetClearanceZ()) + continue; + if (fencePos.clearanceZ <= tileElement->GetBaseZ()) + continue; + if ((tileElement->GetDirection()) != direction) + continue; + + return true; + } while (!(tileElement++)->IsLastForTile()); + return false; +} diff --git a/src/openrct2/world/Wall.h b/src/openrct2/world/Wall.h index 688aa54be1..5043775331 100644 --- a/src/openrct2/world/Wall.h +++ b/src/openrct2/world/Wall.h @@ -26,3 +26,5 @@ void WallRemoveAtZ(const CoordsXYZ& wallPos); void WallRemoveIntersectingWalls(const CoordsXYRangedZ& wallPos, Direction direction); uint8_t GetWallSlopeFromEdgeSlope(uint8_t Slope, uint8_t Edge); + +bool WallInTheWay(const CoordsXYRangedZ& fencePos, int32_t direction);