1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-30 02:05:13 +01:00

Rename IsValidPathZAndDirection and move to more appropriate place

This commit is contained in:
ζeh Matt
2024-09-30 12:53:12 +03:00
parent fdff60552b
commit bc1f2f62cf
5 changed files with 32 additions and 33 deletions

View File

@@ -2328,3 +2328,30 @@ bool PathElement::IsLevelCrossing(const CoordsXY& coords) const
return ride->GetRideTypeDescriptor().HasFlag(RtdFlag::supportsLevelCrossings);
}
bool FootpathIsZAndDirectionValid(TileElement* tileElement, int32_t currentZ, int32_t currentDirection)
{
if (tileElement->AsPath()->IsSloped())
{
int32_t slopeDirection = tileElement->AsPath()->GetSlopeDirection();
if (slopeDirection == currentDirection)
{
if (currentZ != tileElement->BaseHeight)
return false;
}
else
{
slopeDirection = DirectionReverse(slopeDirection);
if (slopeDirection != currentDirection)
return false;
if (currentZ != tileElement->BaseHeight + 2)
return false;
}
}
else
{
if (currentZ != tileElement->BaseHeight)
return false;
}
return true;
}