diff --git a/src/openrct2-ui/ride/Construction.cpp b/src/openrct2-ui/ride/Construction.cpp index b6561fcd79..6ffd81805a 100644 --- a/src/openrct2-ui/ride/Construction.cpp +++ b/src/openrct2-ui/ride/Construction.cpp @@ -365,7 +365,7 @@ namespace OpenRCT2 CoordsXYZD RideGetEntranceOrExitPositionFromScreenPosition(const ScreenCoordsXY& screenCoords) { CoordsXYZD entranceExitCoords{}; - gRideEntranceExitPlaceDirection = INVALID_DIRECTION; + gRideEntranceExitPlaceDirection = kInvalidDirection; // determine if the mouse is hovering over a station - that's the station to add the entrance to auto info = GetMapCoordinatesFromPos(screenCoords, EnumsToFlags(ViewportInteractionItem::Ride)); if (info.interactionType != ViewportInteractionItem::None) @@ -407,7 +407,7 @@ namespace OpenRCT2 return entranceExitCoords; } - entranceExitCoords = { coordsAtHeight->ToTileStart(), stationBaseZ, INVALID_DIRECTION }; + entranceExitCoords = { coordsAtHeight->ToTileStart(), stationBaseZ, kInvalidDirection }; if (ride->type == kRideTypeNull) { @@ -482,7 +482,7 @@ namespace OpenRCT2 } while (!(tileElement++)->IsLastForTile()); } } - gRideEntranceExitPlaceDirection = INVALID_DIRECTION; + gRideEntranceExitPlaceDirection = kInvalidDirection; return entranceExitCoords; } diff --git a/src/openrct2-ui/windows/EditorParkEntrance.cpp b/src/openrct2-ui/windows/EditorParkEntrance.cpp index d2de7a3285..e1d3ac1923 100644 --- a/src/openrct2-ui/windows/EditorParkEntrance.cpp +++ b/src/openrct2-ui/windows/EditorParkEntrance.cpp @@ -129,9 +129,9 @@ namespace OpenRCT2::Ui::Windows CoordsXYZD PlaceParkEntranceGetMapPosition(const ScreenCoordsXY& screenCoords) { - CoordsXYZD parkEntranceMapPosition{ 0, 0, 0, INVALID_DIRECTION }; + CoordsXYZD parkEntranceMapPosition{ 0, 0, 0, kInvalidDirection }; const CoordsXY mapCoords = ViewportInteractionGetTileStartAtCursor(screenCoords); - parkEntranceMapPosition = { mapCoords.x, mapCoords.y, 0, INVALID_DIRECTION }; + parkEntranceMapPosition = { mapCoords.x, mapCoords.y, 0, kInvalidDirection }; if (parkEntranceMapPosition.IsNull()) return parkEntranceMapPosition; diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index 90dc3e158e..a53e317b7a 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -1145,7 +1145,7 @@ namespace OpenRCT2::Ui::Windows PathConstructFlags constructFlags = FootpathCreateConstructFlags(selectedType); auto footpathPlaceAction = FootpathPlaceAction( - { *mapPos, baseZ }, slope, selectedType, gFootpathSelection.Railings, INVALID_DIRECTION, constructFlags); + { *mapPos, baseZ }, slope, selectedType, gFootpathSelection.Railings, kInvalidDirection, constructFlags); footpathPlaceAction.SetCallback([this](const GameAction* ga, const GameActions::Result* result) { if (result->Error == GameActions::Status::Ok) { @@ -1216,7 +1216,7 @@ namespace OpenRCT2::Ui::Windows _provisionalFootpath.flags.clearAll(); gFootpathConstructSlope = 0; _footpathConstructionMode = PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL; - _footpathConstructValidDirections = INVALID_DIRECTION; + _footpathConstructValidDirections = kInvalidDirection; WindowFootpathSetEnabledAndPressedWidgets(); } @@ -1256,7 +1256,7 @@ namespace OpenRCT2::Ui::Windows { if (gFootpathConstructSlope == 0) { - self->_footpathConstructValidDirections = INVALID_DIRECTION; + self->_footpathConstructValidDirections = kInvalidDirection; } else { @@ -1328,7 +1328,7 @@ namespace OpenRCT2::Ui::Windows gFootpathConstructFromPosition.y -= CoordsDirectionDelta[edge].y; gFootpathConstructFromPosition.z = z; _footpathConstructDirection = edge; - _footpathConstructValidDirections = INVALID_DIRECTION; + _footpathConstructValidDirections = kInvalidDirection; } /** @@ -1452,7 +1452,7 @@ namespace OpenRCT2::Ui::Windows // Enable / disable directional widgets direction = _footpathConstructValidDirections; - if (direction != INVALID_DIRECTION) + if (direction != kInvalidDirection) { disabledWidgets |= (1uLL << WIDX_DIRECTION_NW) | (1uLL << WIDX_DIRECTION_NE) | (1uLL << WIDX_DIRECTION_SW) | (1uLL << WIDX_DIRECTION_SE); @@ -1760,7 +1760,7 @@ namespace OpenRCT2::Ui::Windows FootpathRemoveProvisional(); auto footpathPlaceAction = FootpathPlaceAction( - footpathLoc, slope, type, railingsType, INVALID_DIRECTION, constructFlags); + footpathLoc, slope, type, railingsType, kInvalidDirection, constructFlags); footpathPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED); auto res = GameActions::Execute(&footpathPlaceAction); cost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index 2e2b8c682c..88a2418002 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -352,7 +352,7 @@ namespace OpenRCT2::Ui::Windows if (entranceOrExitCoords.IsNull()) return; - if (gRideEntranceExitPlaceDirection == INVALID_DIRECTION) + if (gRideEntranceExitPlaceDirection == kInvalidDirection) return; RideId rideIndex = gRideEntranceExitPlaceRideIndex; diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 78c0caf862..b334dce23b 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -2593,7 +2593,7 @@ namespace OpenRCT2::Ui::Windows gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; CoordsXYZD entranceOrExitCoords = RideGetEntranceOrExitPositionFromScreenPosition(screenCoords); - if (gRideEntranceExitPlaceDirection == INVALID_DIRECTION) + if (gRideEntranceExitPlaceDirection == kInvalidDirection) return; auto rideEntranceExitPlaceAction = RideEntranceExitPlaceAction( @@ -3509,7 +3509,7 @@ namespace OpenRCT2::Ui::Windows gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; CoordsXYZD entranceOrExitCoords = RideGetEntranceOrExitPositionFromScreenPosition(screenCoords); - if (gRideEntranceExitPlaceDirection == INVALID_DIRECTION) + if (gRideEntranceExitPlaceDirection == kInvalidDirection) { RideConstructionInvalidateCurrentTrack(); return; diff --git a/src/openrct2/actions/FootpathPlaceAction.cpp b/src/openrct2/actions/FootpathPlaceAction.cpp index e73cea76b4..270e506f22 100644 --- a/src/openrct2/actions/FootpathPlaceAction.cpp +++ b/src/openrct2/actions/FootpathPlaceAction.cpp @@ -106,7 +106,7 @@ GameActions::Result FootpathPlaceAction::Query() const return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_TOO_HIGH); } - if (_direction != INVALID_DIRECTION && !DirectionValid(_direction)) + if (_direction != kInvalidDirection && !DirectionValid(_direction)) { LOG_ERROR("Direction invalid. direction = %u", _direction); return GameActions::Result( @@ -143,7 +143,7 @@ GameActions::Result FootpathPlaceAction::Execute() const if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { - if (_direction != INVALID_DIRECTION && !getGameState().cheats.disableClearanceChecks) + if (_direction != kInvalidDirection && !getGameState().cheats.disableClearanceChecks) { // It is possible, let's remove walls between the old and new piece of path auto zLow = _loc.z; diff --git a/src/openrct2/actions/FootpathPlaceAction.h b/src/openrct2/actions/FootpathPlaceAction.h index e5192a20cd..2fbde8ab9b 100644 --- a/src/openrct2/actions/FootpathPlaceAction.h +++ b/src/openrct2/actions/FootpathPlaceAction.h @@ -19,14 +19,14 @@ private: uint8_t _slope{}; ObjectEntryIndex _type{}; ObjectEntryIndex _railingsType{}; - Direction _direction{ INVALID_DIRECTION }; + Direction _direction{ kInvalidDirection }; PathConstructFlags _constructFlags{}; public: FootpathPlaceAction() = default; FootpathPlaceAction( const CoordsXYZ& loc, uint8_t slope, ObjectEntryIndex type, ObjectEntryIndex railingsType, - Direction direction = INVALID_DIRECTION, PathConstructFlags constructFlags = 0); + Direction direction = kInvalidDirection, PathConstructFlags constructFlags = 0); void AcceptParameters(GameActionParameterVisitor& visitor) override; uint16_t GetActionFlags() const override; diff --git a/src/openrct2/actions/RideEntranceExitPlaceAction.h b/src/openrct2/actions/RideEntranceExitPlaceAction.h index 39fcc7dd24..aecffe796e 100644 --- a/src/openrct2/actions/RideEntranceExitPlaceAction.h +++ b/src/openrct2/actions/RideEntranceExitPlaceAction.h @@ -16,7 +16,7 @@ class RideEntranceExitPlaceAction final : public GameActionBasePathfindGoal.x = 0xFF; newPeep->PathfindGoal.y = 0xFF; newPeep->PathfindGoal.z = 0xFF; - newPeep->PathfindGoal.direction = INVALID_DIRECTION; + newPeep->PathfindGoal.direction = kInvalidDirection; uint8_t colour = StaffGetColour(static_cast(_staffType)); newPeep->TshirtColour = colour; diff --git a/src/openrct2/actions/WallPlaceAction.h b/src/openrct2/actions/WallPlaceAction.h index 1581221be4..620aabf20e 100644 --- a/src/openrct2/actions/WallPlaceAction.h +++ b/src/openrct2/actions/WallPlaceAction.h @@ -28,7 +28,7 @@ class WallPlaceAction final : public GameActionBase private: ObjectEntryIndex _wallType{ kObjectEntryIndexNull }; CoordsXYZ _loc; - Direction _edge{ INVALID_DIRECTION }; + Direction _edge{ kInvalidDirection }; int32_t _primaryColour{ COLOUR_BLACK }; int32_t _secondaryColour{ COLOUR_BLACK }; int32_t _tertiaryColour{ COLOUR_BLACK }; diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index 3b865d7184..0542af3e8f 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -4713,7 +4713,7 @@ void Guest::UpdateRideApproachSpiralSlide() auto exit = ride->getStation(CurrentRideStation).Exit; waypoint = 1; auto directionTemp = exit.direction; - if (exit.direction == INVALID_DIRECTION) + if (exit.direction == kInvalidDirection) { directionTemp = 0; } diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index 04dec406c6..c4ebf8c157 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -2988,5 +2988,5 @@ void Peep::Paint(PaintSession& session, int32_t imageDirection) const void Peep::ResetPathfindGoal() { PathfindGoal.SetNull(); - PathfindGoal.direction = INVALID_DIRECTION; + PathfindGoal.direction = kInvalidDirection; } diff --git a/src/openrct2/entity/Staff.cpp b/src/openrct2/entity/Staff.cpp index 84f3fe1385..b03b35573b 100644 --- a/src/openrct2/entity/Staff.cpp +++ b/src/openrct2/entity/Staff.cpp @@ -319,7 +319,7 @@ bool Staff::HasPatrolArea() const * * rct2: 0x006BFBE8 * - * Returns INVALID_DIRECTION when no nearby litter or unpathable litter + * Returns kInvalidDirection when no nearby litter or unpathable litter */ Direction Staff::HandymanDirectionToNearestLitter() const { @@ -338,14 +338,14 @@ Direction Staff::HandymanDirectionToNearestLitter() const if (nearestLitterDist > MAX_LITTER_DISTANCE) { - return INVALID_DIRECTION; + return kInvalidDirection; } auto litterTile = CoordsXY{ nearestLitter->x, nearestLitter->y }.ToTileStart(); if (!IsLocationInPatrol(litterTile)) { - return INVALID_DIRECTION; + return kInvalidDirection; } Direction nextDirection = DirectionFromTo(CoordsXY(x, y), litterTile.ToTileCentre()); @@ -356,14 +356,14 @@ Direction Staff::HandymanDirectionToNearestLitter() const TileElement* tileElement = MapGetFirstElementAt(nextTile); if (tileElement == nullptr) - return INVALID_DIRECTION; + return kInvalidDirection; do { if (tileElement->BaseHeight != nextZ) continue; if (tileElement->GetType() == TileElementType::Entrance || tileElement->GetType() == TileElementType::Track) { - return INVALID_DIRECTION; + return kInvalidDirection; } } while (!(tileElement++)->IsLastForTile()); @@ -371,7 +371,7 @@ Direction Staff::HandymanDirectionToNearestLitter() const tileElement = MapGetFirstElementAt(nextTile); if (tileElement == nullptr) - return INVALID_DIRECTION; + return kInvalidDirection; do { @@ -379,7 +379,7 @@ Direction Staff::HandymanDirectionToNearestLitter() const continue; if (tileElement->GetType() == TileElementType::Entrance || tileElement->GetType() == TileElementType::Track) { - return INVALID_DIRECTION; + return kInvalidDirection; } } while (!(tileElement++)->IsLastForTile()); @@ -396,18 +396,18 @@ uint8_t Staff::HandymanDirectionToUncutGrass(uint8_t valid_directions) const { auto surfaceElement = MapGetSurfaceElementAt(NextLoc); if (surfaceElement == nullptr) - return INVALID_DIRECTION; + return kInvalidDirection; if (NextLoc.z != surfaceElement->GetBaseZ()) - return INVALID_DIRECTION; + return kInvalidDirection; if (GetNextIsSloped()) { if (surfaceElement->GetSlope() != kPathSlopeToLandSlope[GetNextDirection()]) - return INVALID_DIRECTION; + return kInvalidDirection; } else if (surfaceElement->GetSlope() != kTileSlopeFlat) - return INVALID_DIRECTION; + return kInvalidDirection; } uint8_t chosenDirection = ScenarioRand() & 0x3; @@ -437,7 +437,7 @@ uint8_t Staff::HandymanDirectionToUncutGrass(uint8_t valid_directions) const } } } - return INVALID_DIRECTION; + return kInvalidDirection; } /** @@ -475,7 +475,7 @@ bool Staff::DoHandymanPathFinding() { StaffMowingTimeout++; - Direction litterDirection = INVALID_DIRECTION; + Direction litterDirection = kInvalidDirection; uint8_t validDirections = GetValidPatrolDirections(NextLoc); if ((StaffOrders & STAFF_ORDERS_SWEEPING) && ((getGameState().currentTicks + Id.ToUnderlying()) & 0xFFF) > 110) @@ -483,13 +483,13 @@ bool Staff::DoHandymanPathFinding() litterDirection = HandymanDirectionToNearestLitter(); } - Direction newDirection = INVALID_DIRECTION; - if (litterDirection == INVALID_DIRECTION && (StaffOrders & STAFF_ORDERS_MOWING) && StaffMowingTimeout >= 12) + Direction newDirection = kInvalidDirection; + if (litterDirection == kInvalidDirection && (StaffOrders & STAFF_ORDERS_MOWING) && StaffMowingTimeout >= 12) { newDirection = HandymanDirectionToUncutGrass(validDirections); } - if (newDirection == INVALID_DIRECTION) + if (newDirection == kInvalidDirection) { if (GetNextIsSurface()) { @@ -510,7 +510,7 @@ bool Staff::DoHandymanPathFinding() else { bool chooseRandom = true; - if (litterDirection != INVALID_DIRECTION && pathDirections & (1 << litterDirection)) + if (litterDirection != kInvalidDirection && pathDirections & (1 << litterDirection)) { /// Check whether path is a queue path and connected to a ride bool connectedQueue = (pathElement->IsQueue() && !pathElement->GetRideIndex().IsNull()); @@ -708,7 +708,7 @@ Direction Staff::MechanicDirectionPath(uint8_t validDirections, PathElement* pat const auto goalPos = TileCoordsXYZ{ location }; Direction pathfindDirection = PathFinding::ChooseDirection( TileCoordsXYZ{ NextLoc }, goalPos, *this, false, RideId::GetNull()); - if (pathfindDirection == INVALID_DIRECTION) + if (pathfindDirection == kInvalidDirection) { /* Heuristic search failed for all directions. * Reset the PathfindGoal - this means that the PathfindHistory @@ -732,7 +732,7 @@ Direction Staff::MechanicDirectionPath(uint8_t validDirections, PathElement* pat bool Staff::DoMechanicPathFinding() { uint8_t validDirections = GetValidPatrolDirections(NextLoc); - Direction newDirection = INVALID_DIRECTION; + Direction newDirection = kInvalidDirection; if (GetNextIsSurface()) { newDirection = MechanicDirectionSurface(); @@ -813,7 +813,7 @@ bool Staff::DoMiscPathFinding() { uint8_t validDirections = GetValidPatrolDirections(NextLoc); - Direction newDirection = INVALID_DIRECTION; + Direction newDirection = kInvalidDirection; if (GetNextIsSurface()) { newDirection = DirectionSurface(ScenarioRand() & 3); diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index f880ff009f..8e7bc7958f 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -1297,7 +1297,7 @@ namespace OpenRCT2::PathFinding } while (!(destTileElement++)->IsLastForTile()); // Peep is not on a path. if (!found) - return INVALID_DIRECTION; + return kInvalidDirection; permittedEdges &= 0xF; uint32_t edges = permittedEdges; @@ -1373,7 +1373,7 @@ namespace OpenRCT2::PathFinding // Peep has tried all edges. if (edges == 0) - return INVALID_DIRECTION; + return kInvalidDirection; int32_t chosenEdge = Numerics::bitScanForward(edges); @@ -1417,7 +1417,7 @@ namespace OpenRCT2::PathFinding for (auto& entry : state.history) { entry.location.SetNull(); - entry.direction = INVALID_DIRECTION; + entry.direction = kInvalidDirection; } /* The pathfinding will only use elements @@ -1506,7 +1506,7 @@ namespace OpenRCT2::PathFinding if (bestScore == 0xFFFF) { LogPathfinding(&peep, "Pathfind heuristic search failed."); - return INVALID_DIRECTION; + return kInvalidDirection; } if constexpr (kLogPathfinding) @@ -1600,7 +1600,7 @@ namespace OpenRCT2::PathFinding const auto goalPos = TileCoordsXYZ(chosenEntrance.value()); Direction chosenDirection = ChooseDirection(TileCoordsXYZ{ peep.NextLoc }, goalPos, peep, true, RideId::GetNull()); - if (chosenDirection == INVALID_DIRECTION) + if (chosenDirection == kInvalidDirection) return GuestPathfindAimless(peep, edges); return PeepMoveOneTile(chosenDirection, peep); @@ -1653,7 +1653,7 @@ namespace OpenRCT2::PathFinding const auto goalPos = TileCoordsXYZ(peepSpawnLoc); direction = ChooseDirection(TileCoordsXYZ{ peep.NextLoc }, goalPos, peep, true, RideId::GetNull()); - if (direction == INVALID_DIRECTION) + if (direction == kInvalidDirection) return GuestPathfindAimless(peep, edges); return PeepMoveOneTile(direction, peep); @@ -1689,7 +1689,7 @@ namespace OpenRCT2::PathFinding } Direction chosenDirection = ChooseDirection(TileCoordsXYZ{ peep.NextLoc }, entranceGoal, peep, true, RideId::GetNull()); - if (chosenDirection == INVALID_DIRECTION) + if (chosenDirection == kInvalidDirection) return GuestPathfindAimless(peep, edges); return PeepMoveOneTile(chosenDirection, peep); @@ -2107,7 +2107,7 @@ namespace OpenRCT2::PathFinding direction = ChooseDirection(TileCoordsXYZ{ peep.NextLoc }, loc, peep, true, rideIndex); - if (direction == INVALID_DIRECTION) + if (direction == kInvalidDirection) { /* Heuristic search failed for all directions. * Reset the PathfindGoal - this means that the PathfindHistory diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index f8002622de..57af905177 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1401,7 +1401,7 @@ namespace OpenRCT2::RCT1 dst->PathfindGoal.x = 0xFF; dst->PathfindGoal.y = 0xFF; dst->PathfindGoal.z = 0xFF; - dst->PathfindGoal.direction = INVALID_DIRECTION; + dst->PathfindGoal.direction = kInvalidDirection; } void ImportStaffPatrolArea(Staff* staffmember, uint8_t staffId) diff --git a/src/openrct2/rct12/ScenarioPatcher.cpp b/src/openrct2/rct12/ScenarioPatcher.cpp index d88449eb7b..d23df4752d 100644 --- a/src/openrct2/rct12/ScenarioPatcher.cpp +++ b/src/openrct2/rct12/ScenarioPatcher.cpp @@ -170,12 +170,12 @@ static Direction GetDirection(const json_t& parameters) { if (!parameters.contains(_directionKey)) { - return INVALID_DIRECTION; + return kInvalidDirection; } else if (!parameters[_directionKey].is_number()) { OpenRCT2::Guard::Assert(0, "Fix direction must be a number"); - return INVALID_DIRECTION; + return kInvalidDirection; } Direction direction = OpenRCT2::Json::GetNumber(parameters[_directionKey]); @@ -183,7 +183,7 @@ static Direction GetDirection(const json_t& parameters) if (direction > 3) { OpenRCT2::Guard::Assert(0, "Direction must be between 0 and 3"); - return INVALID_DIRECTION; + return kInvalidDirection; } return direction; @@ -654,7 +654,7 @@ static void ApplyPathFixes(const json_t& scenarioPatch) for (auto coordinate : coordinates) { - auto slope = direction != INVALID_DIRECTION ? direction + 4 : 0; + auto slope = direction != kInvalidDirection ? direction + 4 : 0; auto footpathPlaceAction = FootpathPlaceAction( coordinate.ToCoordsXYZ(), slope, surfaceObjIndex, railingsObjIndex, direction, constructionFlags); auto result = footpathPlaceAction.Execute(); diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index b86d48ec3a..b7e95846c1 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1651,7 +1651,7 @@ namespace OpenRCT2::RCT2 void ImportEntityPeep(::Peep* dst, const Peep* src) { const auto isNullLocation = [](const RCT12xyzd8& pos) { - return pos.x == 0xFF && pos.y == 0xFF && pos.z == 0xFF && pos.direction == INVALID_DIRECTION; + return pos.x == 0xFF && pos.y == 0xFF && pos.z == 0xFF && pos.direction == kInvalidDirection; }; ImportEntityCommonProperties(static_cast(dst), src); @@ -1697,7 +1697,7 @@ namespace OpenRCT2::RCT2 if (isNullLocation(src->PathfindGoal)) { dst->PathfindGoal.SetNull(); - dst->PathfindGoal.direction = INVALID_DIRECTION; + dst->PathfindGoal.direction = kInvalidDirection; } else { @@ -1709,7 +1709,7 @@ namespace OpenRCT2::RCT2 if (isNullLocation(src->PathfindHistory[i])) { dst->PathfindHistory[i].SetNull(); - dst->PathfindHistory[i].direction = INVALID_DIRECTION; + dst->PathfindHistory[i].direction = kInvalidDirection; } else { diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index 8ce2b55d37..42e9e49b8e 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -253,7 +253,7 @@ void Ride::removePeeps() auto stationIndex = RideGetFirstValidStationStart(*this); // Get exit position and direction - auto exitPosition = CoordsXYZD{ 0, 0, 0, INVALID_DIRECTION }; + auto exitPosition = CoordsXYZD{ 0, 0, 0, kInvalidDirection }; if (!stationIndex.IsNull()) { auto location = getStation(stationIndex).Exit.ToCoordsXYZD(); @@ -285,7 +285,7 @@ void Ride::removePeeps() if (peep->State == PeepState::QueuingFront && peep->RideSubState == PeepRideSubState::AtEntrance) peep->RemoveFromQueue(); - if (exitPosition.direction == INVALID_DIRECTION) + if (exitPosition.direction == kInvalidDirection) { CoordsXYZ newLoc = { peep->NextLoc.ToTileCentre(), peep->NextLoc.z }; if (peep->GetNextIsSloped()) @@ -315,7 +315,7 @@ void Ride::removePeeps() if (peep->CurrentRide != id) continue; - if (exitPosition.direction == INVALID_DIRECTION) + if (exitPosition.direction == kInvalidDirection) { CoordsXYZ newLoc = { peep->NextLoc.ToTileCentre(), peep->NextLoc.z }; if (peep->GetNextIsSloped()) @@ -1185,14 +1185,14 @@ void Ride::validateStations() continue; CoordsXYZ location = station.GetStart(); - uint8_t direction = INVALID_DIRECTION; + uint8_t direction = kInvalidDirection; bool specialTrack = false; TileElement* tileElement = nullptr; while (true) { // search backwards for the previous station TrackElement (only if the first station TrackElement is found) - if (direction != INVALID_DIRECTION) + if (direction != kInvalidDirection) { location.x -= CoordsDirectionDelta[direction].x; location.y -= CoordsDirectionDelta[direction].y; diff --git a/src/openrct2/world/Location.hpp b/src/openrct2/world/Location.hpp index 46a69cda6b..ec09d12eab 100644 --- a/src/openrct2/world/Location.hpp +++ b/src/openrct2/world/Location.hpp @@ -536,7 +536,7 @@ struct TileCoordsXYRangedZ : public TileCoordsXY */ using Direction = uint8_t; -const Direction INVALID_DIRECTION = 0xFF; +const Direction kInvalidDirection = 0xFF; /** * Array of all valid cardinal directions, to make it easy to write range-based for loops like: @@ -736,7 +736,7 @@ struct TileCoordsXYZD : public TileCoordsXYZ constexpr void SetNull() { TileCoordsXYZ::SetNull(); - direction = INVALID_DIRECTION; + direction = kInvalidDirection; } }; diff --git a/test/tests/Pathfinding.cpp b/test/tests/Pathfinding.cpp index 49665add66..c12e64fe7c 100644 --- a/test/tests/Pathfinding.cpp +++ b/test/tests/Pathfinding.cpp @@ -88,7 +88,7 @@ protected: // Pick the direction the peep should initially move in, given the goal position. // This will also store the goal position and initialize pathfinding data for the peep. const Direction moveDir = PathFinding::ChooseDirection(*pos, goal, *peep, false, RideId::GetNull()); - if (moveDir == INVALID_DIRECTION) + if (moveDir == kInvalidDirection) { // Couldn't determine a direction to move off in return false;