1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-15 12:02:34 +01:00

Create landSlopeFitsUnderPath() function

This commit is contained in:
Gymnasiast
2025-11-29 13:39:25 +01:00
parent 530fc8fa59
commit 4828fbd918

View File

@@ -111,6 +111,16 @@ static bool landSlopeFitsUnderTrack(int32_t baseZ, uint8_t slope, const TrackEle
return false; return false;
} }
static bool landSlopeFitsUnderPath(int32_t baseZ, uint8_t slope, const PathElement& pathElement)
{
const auto slopeCornerHeights = GetSlopeCornerHeights(baseZ, slope);
const uint8_t pathSlope = Numerics::rol4(kTileSlopeSWSideUp, pathElement.GetSlopeDirection());
const auto pathCornerHeights = GetSlopeCornerHeights(pathElement.GetBaseZ(), pathSlope);
return (slopeCornerHeights <= pathCornerHeights);
}
static bool MapLoc68BABCShouldContinue( static bool MapLoc68BABCShouldContinue(
TileElement** tileElementPtr, const CoordsXYRangedZ& pos, CLEAR_FUNC clearFunc, const uint8_t flags, money64& price, TileElement** tileElementPtr, const CoordsXYRangedZ& pos, CLEAR_FUNC clearFunc, const uint8_t flags, money64& price,
const CreateCrossingMode crossingMode, const bool canBuildCrossing, const uint8_t slope) const CreateCrossingMode crossingMode, const bool canBuildCrossing, const uint8_t slope)
@@ -135,13 +145,7 @@ static bool MapLoc68BABCShouldContinue(
if (slope != kTileSlopeFlat && tileElement->GetType() == TileElementType::Path && tileElement->AsPath()->IsSloped()) if (slope != kTileSlopeFlat && tileElement->GetType() == TileElementType::Path && tileElement->AsPath()->IsSloped())
{ {
const auto slopeCornerHeights = GetSlopeCornerHeights(pos.baseZ, slope); if (landSlopeFitsUnderPath(pos.baseZ, slope, *tileElement->AsPath()))
const PathElement& pathElement = *tileElement->AsPath();
const uint8_t pathSlope = Numerics::rol4(kTileSlopeSWSideUp, pathElement.GetSlopeDirection());
const auto pathCornerHeights = GetSlopeCornerHeights(pathElement.GetBaseZ(), pathSlope);
if (slopeCornerHeights <= pathCornerHeights)
{ {
return true; return true;
} }