diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index a10b5dfefc..5ac22ba7f4 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -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; } } diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 6e36ccf071..16f47716cc 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -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))) diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 62dde13ad6..c01ae7371f 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -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; diff --git a/src/openrct2/actions/BannerPlaceAction.cpp b/src/openrct2/actions/BannerPlaceAction.cpp index cf1002f4d9..88efacd5fa 100644 --- a/src/openrct2/actions/BannerPlaceAction.cpp +++ b/src/openrct2/actions/BannerPlaceAction.cpp @@ -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({ _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(_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))) diff --git a/src/openrct2/actions/FootpathAdditionPlaceAction.cpp b/src/openrct2/actions/FootpathAdditionPlaceAction.cpp index f5e79e09a4..ff8f176b0d 100644 --- a/src/openrct2/actions/FootpathAdditionPlaceAction.cpp +++ b/src/openrct2/actions/FootpathAdditionPlaceAction.cpp @@ -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); } diff --git a/src/openrct2/actions/FootpathAdditionRemoveAction.cpp b/src/openrct2/actions/FootpathAdditionRemoveAction.cpp index 71ab50eb27..7cefb89925 100644 --- a/src/openrct2/actions/FootpathAdditionRemoveAction.cpp +++ b/src/openrct2/actions/FootpathAdditionRemoveAction.cpp @@ -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); } diff --git a/src/openrct2/actions/FootpathLayoutPlaceAction.cpp b/src/openrct2/actions/FootpathLayoutPlaceAction.cpp index 15b1d594e3..5b53183c72 100644 --- a/src/openrct2/actions/FootpathLayoutPlaceAction.cpp +++ b/src/openrct2/actions/FootpathLayoutPlaceAction.cpp @@ -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) { diff --git a/src/openrct2/actions/FootpathPlaceAction.cpp b/src/openrct2/actions/FootpathPlaceAction.cpp index eaf33b9943..acd7705f79 100644 --- a/src/openrct2/actions/FootpathPlaceAction.cpp +++ b/src/openrct2/actions/FootpathPlaceAction.cpp @@ -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) { diff --git a/src/openrct2/entity/Litter.cpp b/src/openrct2/entity/Litter.cpp index 7bb3acbd43..2f1dc3e85d 100644 --- a/src/openrct2/entity/Litter.cpp +++ b/src/openrct2/entity/Litter.cpp @@ -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); diff --git a/src/openrct2/entity/Staff.cpp b/src/openrct2/entity/Staff.cpp index 3dab17761c..af50f93483 100644 --- a/src/openrct2/entity/Staff.cpp +++ b/src/openrct2/entity/Staff.cpp @@ -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( - { tileCoords, tileCoords.z + PATH_HEIGHT_STEP }); + { tileCoords, tileCoords.z + kPathHeightStep }); if (trackElement == nullptr) return false; diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index 61dc587422..14e0cb4b77 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -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)) diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 4eb3b9ab7f..dc7ffe7554 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -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({ position, position.z + PATH_HEIGHT_STEP }); + auto pathElement = MapGetFirstTileElementWithBaseHeightBetween({ position, position.z + kPathHeightStep }); return pathElement != nullptr && pathElement->IsBlockedByVehicle(); } diff --git a/src/openrct2/world/Footpath.h b/src/openrct2/world/Footpath.h index 209b7cfcb7..a0af56b7ac 100644 --- a/src/openrct2/world/Footpath.h +++ b/src/openrct2/world/Footpath.h @@ -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 {