1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Move WallInTheWay() to Wall.{cpp,h}

This commit is contained in:
Gymnasiast
2025-09-14 17:01:16 +02:00
parent 61db76f74b
commit 5cc8ab4fa5
6 changed files with 38 additions and 34 deletions

View File

@@ -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"

View File

@@ -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"

View File

@@ -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))

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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);