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

Rename footpath height related constants

This commit is contained in:
Aaron van Geffen
2024-08-16 23:18:33 +02:00
committed by GitHub
parent 4bdbd787a9
commit 5f37ba6615
13 changed files with 49 additions and 49 deletions

View File

@@ -823,7 +823,7 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
if (slope & RAISE_FOOTPATH_FLAG)
{
slope &= ~RAISE_FOOTPATH_FLAG;
z += PATH_HEIGHT_STEP;
z += kPathHeightStep;
}
auto pathType = gFootpathSelection.GetSelectedSurface();
@@ -866,10 +866,10 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
uint8_t slope = tileElement->AsSurface()->GetSlope();
if (slope & kTileSlopeRaisedCornersMask)
{
z += PATH_HEIGHT_STEP;
z += kPathHeightStep;
} // Add 2 for a slope
if (slope & kTileSlopeDiagonalFlag)
z += PATH_HEIGHT_STEP; // Add another 2 for a steep slope
z += kPathHeightStep; // Add another 2 for a steep slope
}
gMapSelectArrowPosition = CoordsXYZ{ mapCoords, z };
@@ -920,7 +920,7 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
if (slope & RAISE_FOOTPATH_FLAG)
{
slope &= ~RAISE_FOOTPATH_FLAG;
z += PATH_HEIGHT_STEP;
z += kPathHeightStep;
}
// Try and place path
@@ -970,12 +970,12 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
if (slope & kTileSlopeDiagonalFlag)
{
// Steep diagonal slope
z += 2 * PATH_HEIGHT_STEP;
z += 2 * kPathHeightStep;
}
else if (slope & kTileSlopeRaisedCornersMask)
{
// Normal slope
z += PATH_HEIGHT_STEP;
z += kPathHeightStep;
}
}
else
@@ -987,7 +987,7 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
{
if (direction == (tileElement->AsPath()->GetSlopeDirection()))
{
z += PATH_HEIGHT_STEP;
z += kPathHeightStep;
}
}
}
@@ -1056,7 +1056,7 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
// already is lowered if we are building a downwards slope.
if (gFootpathConstructSlope == 2)
{
gFootpathConstructFromPosition.z += PATH_HEIGHT_STEP;
gFootpathConstructFromPosition.z += kPathHeightStep;
}
}
self->WindowFootpathSetEnabledAndPressedWidgets();
@@ -1077,7 +1077,7 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
slopeDirection = DirectionReverse(slopeDirection);
if (slopeDirection == _footpathConstructDirection)
{
z += PATH_HEIGHT_STEP;
z += kPathHeightStep;
}
}
@@ -1128,7 +1128,7 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
}
z = std::min(255 * kCoordsZStep, gFootpathConstructFromPosition.z);
zLow = z - PATH_HEIGHT_STEP;
zLow = z - kPathHeightStep;
tileElement = MapGetFirstElementAt(gFootpathConstructFromPosition);
do
@@ -1277,7 +1277,7 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
*slope = _footpathConstructDirection | kTileSlopeSCornerUp;
if (gFootpathConstructSlope != 2)
{
footpathLoc.z -= PATH_HEIGHT_STEP;
footpathLoc.z -= kPathHeightStep;
*slope ^= kTileSlopeECornerUp;
}
}

View File

@@ -3390,7 +3390,7 @@ static Widget _rideConstructionWidgets[] = {
// Sloped path on the level below
if (pathsByDir[i] == nullptr)
{
pathsByDir[i] = MapGetFootpathElement({ *mapCoords + CoordsDirectionDelta[i], z - PATH_HEIGHT_STEP });
pathsByDir[i] = MapGetFootpathElement({ *mapCoords + CoordsDirectionDelta[i], z - kPathHeightStep });
if (pathsByDir[i] != nullptr
&& (!pathsByDir[i]->IsSloped() || pathsByDir[i]->GetSlopeDirection() != DirectionReverse(i)))

View File

@@ -2187,7 +2187,7 @@ static Widget WindowSceneryBaseWidgets[] = {
return kMoney64Undefined;
gSceneryGhostPosition = loc;
gSceneryGhostPosition.z += PATH_HEIGHT_STEP;
gSceneryGhostPosition.z += kPathHeightStep;
gSceneryPlaceRotation = loc.direction;
gSceneryGhostType |= SCENERY_GHOST_FLAG_4;
return res.Cost;

View File

@@ -81,7 +81,7 @@ GameActions::Result BannerPlaceAction::Query() const
return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
auto baseHeight = _loc.z + PATH_HEIGHT_STEP;
auto baseHeight = _loc.z + kPathHeightStep;
BannerElement* existingBannerElement = MapGetBannerElementAt({ _loc.x, _loc.y, baseHeight }, _loc.direction);
if (existingBannerElement != nullptr)
{
@@ -151,7 +151,7 @@ GameActions::Result BannerPlaceAction::Execute() const
auto* bannerElement = TileElementInsert<BannerElement>({ _loc, _loc.z + (2 * kCoordsZStep) }, 0b0000);
Guard::Assert(bannerElement != nullptr);
bannerElement->SetClearanceZ(_loc.z + PATH_CLEARANCE);
bannerElement->SetClearanceZ(_loc.z + kPathClearance);
bannerElement->SetPosition(_loc.direction);
bannerElement->ResetAllowedEdges();
bannerElement->SetIndex(banner->id);
@@ -168,7 +168,7 @@ PathElement* BannerPlaceAction::GetValidPathElement() const
{
for (auto* pathElement : TileElementsView<PathElement>(_loc))
{
if (pathElement->GetBaseZ() != _loc.z && pathElement->GetBaseZ() != _loc.z - PATH_HEIGHT_STEP)
if (pathElement->GetBaseZ() != _loc.z && pathElement->GetBaseZ() != _loc.z - kPathHeightStep)
continue;
if (!(pathElement->GetEdges() & (1 << _loc.direction)))

View File

@@ -67,12 +67,12 @@ GameActions::Result FootpathAdditionPlaceAction::Query() const
return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
if (_loc.z < FootpathMinHeight)
if (_loc.z < kFootpathMinHeight)
{
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_LOW);
}
if (_loc.z > FootpathMaxHeight)
if (_loc.z > kFootpathMaxHeight)
{
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_HIGH);
}

View File

@@ -59,12 +59,12 @@ GameActions::Result FootpathAdditionRemoveAction::Query() const
return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
}
if (_loc.z < FootpathMinHeight)
if (_loc.z < kFootpathMinHeight)
{
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_TOO_LOW);
}
if (_loc.z > FootpathMaxHeight)
if (_loc.z > kFootpathMaxHeight)
{
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_TOO_HIGH);
}

View File

@@ -83,13 +83,13 @@ GameActions::Result FootpathLayoutPlaceAction::Query() const
GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
if (_loc.z < FootpathMinHeight)
if (_loc.z < kFootpathMinHeight)
{
return GameActions::Result(
GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TOO_LOW);
}
if (_loc.z > FootpathMaxHeight)
if (_loc.z > kFootpathMaxHeight)
{
return GameActions::Result(
GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TOO_HIGH);
@@ -133,11 +133,11 @@ GameActions::Result FootpathLayoutPlaceAction::ElementInsertQuery(GameActions::R
QuarterTile quarterTile{ 0b1111, 0 };
auto zLow = _loc.z;
auto zHigh = zLow + PATH_CLEARANCE;
auto zHigh = zLow + kPathClearance;
if (_slope & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED)
{
quarterTile = QuarterTile{ 0b1111, 0b1100 }.Rotate(_slope & kTileElementDirectionMask);
zHigh += PATH_HEIGHT_STEP;
zHigh += kPathHeightStep;
}
auto entranceElement = MapGetParkEntranceElementAt(_loc, false);
@@ -181,7 +181,7 @@ GameActions::Result FootpathLayoutPlaceAction::ElementInsertQuery(GameActions::R
STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
}
int32_t supportHeight = zLow - surfaceElement->GetBaseZ();
res.Cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / PATH_HEIGHT_STEP) * 5.00_GBP;
res.Cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / kPathHeightStep) * 5.00_GBP;
// Prevent the place sound from being spammed
if (entranceIsSamePath)
@@ -203,11 +203,11 @@ GameActions::Result FootpathLayoutPlaceAction::ElementInsertExecute(GameActions:
QuarterTile quarterTile{ 0b1111, 0 };
auto zLow = _loc.z;
auto zHigh = zLow + PATH_CLEARANCE;
auto zHigh = zLow + kPathClearance;
if (_slope & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED)
{
quarterTile = QuarterTile{ 0b1111, 0b1100 }.Rotate(_slope & kTileElementDirectionMask);
zHigh += PATH_HEIGHT_STEP;
zHigh += kPathHeightStep;
}
auto entranceElement = MapGetParkEntranceElementAt(_loc, false);
@@ -245,7 +245,7 @@ GameActions::Result FootpathLayoutPlaceAction::ElementInsertExecute(GameActions:
STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
}
int32_t supportHeight = zLow - surfaceElement->GetBaseZ();
res.Cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / PATH_HEIGHT_STEP) * 5.00_GBP;
res.Cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / kPathHeightStep) * 5.00_GBP;
if (entrancePath)
{

View File

@@ -92,12 +92,12 @@ GameActions::Result FootpathPlaceAction::Query() const
return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_LAND_SLOPE_UNSUITABLE);
}
if (_loc.z < FootpathMinHeight)
if (_loc.z < kFootpathMinHeight)
{
return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_TOO_LOW);
}
if (_loc.z > FootpathMaxHeight)
if (_loc.z > kFootpathMaxHeight)
{
return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_TOO_HIGH);
}
@@ -141,7 +141,7 @@ GameActions::Result FootpathPlaceAction::Execute() const
{
// It is possible, let's remove walls between the old and new piece of path
auto zLow = _loc.z;
auto zHigh = zLow + PATH_CLEARANCE;
auto zHigh = zLow + kPathClearance;
WallRemoveIntersectingWalls(
{ _loc, zLow, zHigh + ((_slope & kTileSlopeRaisedCornersMask) ? 16 : 0) }, DirectionReverse(_direction));
WallRemoveIntersectingWalls(
@@ -283,11 +283,11 @@ GameActions::Result FootpathPlaceAction::ElementInsertQuery(GameActions::Result
QuarterTile quarterTile{ 0b1111, 0 };
auto zLow = _loc.z;
auto zHigh = zLow + PATH_CLEARANCE;
auto zHigh = zLow + kPathClearance;
if (_slope & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED)
{
quarterTile = QuarterTile{ 0b1111, 0b1100 }.Rotate(_slope & kTileElementDirectionMask);
zHigh += PATH_HEIGHT_STEP;
zHigh += kPathHeightStep;
}
auto entranceElement = MapGetParkEntranceElementAt(_loc, false);
@@ -330,7 +330,7 @@ GameActions::Result FootpathPlaceAction::ElementInsertQuery(GameActions::Result
GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
}
int32_t supportHeight = zLow - surfaceElement->GetBaseZ();
res.Cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / PATH_HEIGHT_STEP) * 5.00_GBP;
res.Cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / kPathHeightStep) * 5.00_GBP;
// Prevent the place sound from being spammed
if (entranceIsSamePath)
@@ -352,11 +352,11 @@ GameActions::Result FootpathPlaceAction::ElementInsertExecute(GameActions::Resul
QuarterTile quarterTile{ 0b1111, 0 };
auto zLow = _loc.z;
auto zHigh = zLow + PATH_CLEARANCE;
auto zHigh = zLow + kPathClearance;
if (_slope & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED)
{
quarterTile = QuarterTile{ 0b1111, 0b1100 }.Rotate(_slope & kTileElementDirectionMask);
zHigh += PATH_HEIGHT_STEP;
zHigh += kPathHeightStep;
}
auto entranceElement = MapGetParkEntranceElementAt(_loc, false);
@@ -393,7 +393,7 @@ GameActions::Result FootpathPlaceAction::ElementInsertExecute(GameActions::Resul
GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_ERR_SURFACE_ELEMENT_NOT_FOUND);
}
int32_t supportHeight = zLow - surfaceElement->GetBaseZ();
res.Cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / PATH_HEIGHT_STEP) * 5.00_GBP;
res.Cost += supportHeight < 0 ? 20.00_GBP : (supportHeight / kPathHeightStep) * 5.00_GBP;
if (entrancePath)
{

View File

@@ -35,7 +35,7 @@ static bool IsLocationLitterable(const CoordsXYZ& mapPos)
continue;
int32_t pathZ = tileElement->GetBaseZ();
if (pathZ < mapPos.z || pathZ >= mapPos.z + PATH_CLEARANCE)
if (pathZ < mapPos.z || pathZ >= mapPos.z + kPathClearance)
continue;
return !TileElementIsUnderground(tileElement);

View File

@@ -165,7 +165,7 @@ bool Staff::CanIgnoreWideFlag(const CoordsXYZ& staffPos, TileElement* path) cons
{
if (path->AsPath()->GetSlopeDirection() == adjac_dir)
{
adjacPos.z += PATH_HEIGHT_STEP;
adjacPos.z += kPathHeightStep;
}
}
@@ -859,7 +859,7 @@ bool Staff::IsMechanicHeadingToFixRideBlockingPath()
auto tileCoords = TileCoordsXYZ(CoordsXYZ{ GetDestination(), NextLoc.z });
auto trackElement = MapGetFirstTileElementWithBaseHeightBetween<TrackElement>(
{ tileCoords, tileCoords.z + PATH_HEIGHT_STEP });
{ tileCoords, tileCoords.z + kPathHeightStep });
if (trackElement == nullptr)
return false;

View File

@@ -240,7 +240,7 @@ namespace OpenRCT2::PathFinding
*/
static int32_t GuestSurfacePathFinding(Peep& peep)
{
auto pathPos = CoordsXYRangedZ{ peep.NextLoc, peep.NextLoc.z, peep.NextLoc.z + PATH_CLEARANCE };
auto pathPos = CoordsXYRangedZ{ peep.NextLoc, peep.NextLoc.z, peep.NextLoc.z + kPathClearance };
Direction randDirection = ScenarioRand() & 3;
if (!WallInTheWay(pathPos, randDirection))

View File

@@ -1200,7 +1200,7 @@ static int32_t FootpathIsConnectedToMapEdgeHelper(CoordsXYZ footpathPos, int32_t
{
if (DirectionReverse(ste_slopeDirection) != ste_direction)
return true;
if (ste_tileElement->GetBaseZ() + PATH_HEIGHT_STEP != ste_targetPos.z)
if (ste_tileElement->GetBaseZ() + kPathHeightStep != ste_targetPos.z)
return true;
}
else if (ste_tileElement->GetBaseZ() != ste_targetPos.z)
@@ -1279,7 +1279,7 @@ static int32_t FootpathIsConnectedToMapEdgeHelper(CoordsXYZ footpathPos, int32_t
{
// Only possible direction to go
if (tileElement->AsPath()->IsSloped() && tileElement->AsPath()->GetSlopeDirection() == currentTile.direction)
targetPos.z += PATH_HEIGHT_STEP;
targetPos.z += kPathHeightStep;
// Prepare the next iteration
currentTile.footpathPos = targetPos;
@@ -1308,7 +1308,7 @@ static int32_t FootpathIsConnectedToMapEdgeHelper(CoordsXYZ footpathPos, int32_t
if (tileElement->AsPath()->IsSloped()
&& tileElement->AsPath()->GetSlopeDirection() == currentTile.direction)
{
targetPos.z += PATH_HEIGHT_STEP;
targetPos.z += kPathHeightStep;
}
// Add each possible path to the list of pending tiles
@@ -1869,7 +1869,7 @@ void FootpathUpdatePathWideFlags(const CoordsXY& footpathPos)
bool FootpathIsBlockedByVehicle(const TileCoordsXYZ& position)
{
auto pathElement = MapGetFirstTileElementWithBaseHeightBetween<PathElement>({ position, position.z + PATH_HEIGHT_STEP });
auto pathElement = MapGetFirstTileElementWithBaseHeightBetween<PathElement>({ position, position.z + kPathHeightStep });
return pathElement != nullptr && pathElement->IsBlockedByVehicle();
}

View File

@@ -25,10 +25,10 @@ enum
PROVISIONAL_PATH_FLAG_2 = (1 << 2),
};
constexpr auto FootpathMaxHeight = 248 * kCoordsZStep;
constexpr auto FootpathMinHeight = 2 * kCoordsZStep;
constexpr auto PATH_HEIGHT_STEP = 2 * kCoordsZStep;
constexpr auto PATH_CLEARANCE = 4 * kCoordsZStep;
constexpr auto kFootpathMaxHeight = 248 * kCoordsZStep;
constexpr auto kFootpathMinHeight = 2 * kCoordsZStep;
constexpr auto kPathHeightStep = 2 * kCoordsZStep;
constexpr auto kPathClearance = 4 * kCoordsZStep;
enum class RailingEntrySupportType : uint8_t
{