Merge pull request #21438 from ZehMatt/pathfinding-update-2

More refactoring around path finding
This commit is contained in:
Michael Steenbeek 2024-02-24 23:57:54 +01:00 committed by GitHub
commit 3beeca3fe3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 261 additions and 471 deletions

View File

@ -1,6 +1,6 @@
---
Checks: >
*-,
-*,
cppcoreguidelines-macro-usage,
modernize-use-nullptr,
modernize-use-override

View File

@ -2858,13 +2858,6 @@ void Peep::Paint(PaintSession& session, int32_t imageDirection) const
*/
void Peep::ResetPathfindGoal()
{
#if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
if (_pathFindDebug)
{
LOG_INFO("Resetting PathfindGoal for %s", _pathFindDebugPeepName);
}
#endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
PathfindGoal.SetNull();
PathfindGoal.direction = INVALID_DIRECTION;
}

View File

@ -199,7 +199,7 @@ enum PeepFlags : uint32_t
{
PEEP_FLAGS_LEAVING_PARK = (1 << 0),
PEEP_FLAGS_SLOW_WALK = (1 << 1),
PEEP_FLAGS_2 = (1 << 2),
PEEP_FLAGS_DEBUG_PATHFINDING = (1 << 2), // Enables debug logging for path finding
PEEP_FLAGS_TRACKING = (1 << 3),
PEEP_FLAGS_WAVING = (1 << 4), // Makes the peep wave
PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY = (1 << 5), // Set on paying to enter park

View File

@ -716,17 +716,8 @@ Direction Staff::MechanicDirectionPath(uint8_t validDirections, PathElement* pat
gPeepPathFindIgnoreForeignQueues = false;
gPeepPathFindQueueRideIndex = RideId::GetNull();
#if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
PathfindLoggingEnable(*this);
#endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
const auto goalPos = TileCoordsXYZ{ location };
Direction pathfindDirection = PathFinding::ChooseDirection(TileCoordsXYZ{ NextLoc }, goalPos, *this);
#if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
PathfindLoggingDisable();
#endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
if (pathfindDirection == INVALID_DIRECTION)
{
/* Heuristic search failed for all directions.

File diff suppressed because it is too large Load Diff

View File

@ -46,17 +46,4 @@ namespace OpenRCT2::PathFinding
bool IsValidPathZAndDirection(TileElement* tileElement, int32_t currentZ, int32_t currentDirection);
#if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
# define PATHFIND_DEBUG \
0 // Set to 0 to disable pathfinding debugging;
// Set to 1 to enable pathfinding debugging.
// When PATHFIND_DEBUG is 1 (nonzero):
// The following calls configure debug logging for the given peep
// If they're a guest, pathfinding will be logged if they have PEEP_FLAGS_TRACKING set
// If they're staff, pathfinding will be logged if their name is "Mechanic Debug"
void PathfindLoggingEnable(Peep& peep);
void PathfindLoggingDisable();
#endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
}; // namespace OpenRCT2::PathFinding