diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index dbe940cf43..caa7249a7e 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -2123,7 +2123,7 @@ void window_guest_debug_paint(rct_window* w, rct_drawpixelinfo* dpi) screenCoords.y += LIST_ROW_HEIGHT; screenCoords.x += 10; - for (auto& point : peep->pathfind_history) + for (auto& point : peep->PathfindHistory) { int32_t args[] = { point.x, point.y, point.z, point.direction }; gfx_draw_string_left(dpi, STR_PEEP_DEBUG_PATHFIND_HISTORY_ITEM, args, 0, screenCoords.x, screenCoords.y); diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index e367a5773d..e5a5d07d6d 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -288,7 +288,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, pathfind_goal); for (int i = 0; i < 4; i++) { - COMPARE_FIELD(Peep, pathfind_history[i]); + COMPARE_FIELD(Peep, PathfindHistory[i]); } COMPARE_FIELD(Peep, NoActionFrameNum); COMPARE_FIELD(Peep, LitterCount); diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index 012109648e..6d760db358 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -975,14 +975,14 @@ static void peep_pathfind_heuristic_search( /* First check if going through the junction would be * a loop. If so, the current search path ends here. * Path finding loop detection can take advantage of both the - * peep->pathfind_history - loops through remembered junctions + * peep->PathfindHistory - loops through remembered junctions * the peep has already passed through getting to its * current position while on the way to its current goal; * _peepPathFindHistory - loops in the current search path. */ bool pathLoop = false; - /* Check the peep->pathfind_history to see if this junction has + /* Check the peep->PathfindHistory to see if this junction has * already been visited by the peep while heading for this goal. */ - for (auto& pathfindHistory : peep->pathfind_history) + for (auto& pathfindHistory : peep->PathfindHistory) { if (pathfindHistory.x == loc.x && pathfindHistory.y == loc.y && pathfindHistory.z == loc.z) { @@ -1221,7 +1221,7 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) } /* Check if this path element is a thin junction. - * Only 'thin' junctions are remembered in peep->pathfind_history. + * Only 'thin' junctions are remembered in peep->PathfindHistory. * NO attempt is made to merge the overlaid path elements and * check if the combination is 'thin'! * The junction is considered 'thin' simply if any of the @@ -1239,8 +1239,8 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) uint8_t edges = permitted_edges; if (isThin && peep->pathfind_goal.x == goal.x && peep->pathfind_goal.y == goal.y && peep->pathfind_goal.z == goal.z) { - /* Use of peep->pathfind_history[]: - * When walking to a goal, the peep pathfind_history stores + /* Use of peep->PathfindHistory[]: + * When walking to a goal, the peep PathfindHistory stores * the last 4 thin junctions that the peep walked through. * For each of these 4 thin junctions the peep remembers * those edges it has not yet taken. @@ -1254,11 +1254,11 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) /* If the peep remembers walking through this junction * previously while heading for its goal, retrieve the * directions it has not yet tried. */ - for (auto& pathfindHistory : peep->pathfind_history) + for (auto& pathfindHistory : peep->PathfindHistory) { if (pathfindHistory.x == loc.x && pathfindHistory.y == loc.y && pathfindHistory.z == loc.z) { - /* Fix broken pathfind_history[i].direction + /* Fix broken PathfindHistory[i].direction * which have untried directions that are not * currently possible - could be due to pathing * changes or in earlier code .directions was @@ -1303,7 +1303,7 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) } /* If this is a new goal for the peep. Store it and reset the peep's - * pathfind_history. */ + * PathfindHistory. */ if (!direction_valid(peep->pathfind_goal.direction) || peep->pathfind_goal.x != goal.x || peep->pathfind_goal.y != goal.y || peep->pathfind_goal.z != goal.z) { @@ -1313,7 +1313,7 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) peep->pathfind_goal.direction = 0; // Clear pathfinding history - std::fill_n(reinterpret_cast(peep->pathfind_history), sizeof(peep->pathfind_history), 0xFF); + std::fill_n(reinterpret_cast(peep->PathfindHistory), sizeof(peep->PathfindHistory), 0xFF); #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (gPathFindDebug) { @@ -1488,15 +1488,15 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) { for (int32_t i = 0; i < 4; ++i) { - if (peep->pathfind_history[i].x == loc.x && peep->pathfind_history[i].y == loc.y - && peep->pathfind_history[i].z == loc.z) + if (peep->PathfindHistory[i].x == loc.x && peep->PathfindHistory[i].y == loc.y + && peep->PathfindHistory[i].z == loc.z) { /* Peep remembers this junction, so remove the * chosen_edge from those left to try. */ - peep->pathfind_history[i].direction &= ~(1 << chosen_edge); + peep->PathfindHistory[i].direction &= ~(1 << chosen_edge); /* Also remove the edge through which the peep * entered the junction from those left to try. */ - peep->pathfind_history[i].direction &= ~(1 << direction_reverse(peep->direction)); + peep->PathfindHistory[i].direction &= ~(1 << direction_reverse(peep->direction)); #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (gPathFindDebug) { @@ -1513,15 +1513,15 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) * and remember this junction. */ int32_t i = peep->pathfind_goal.direction++; peep->pathfind_goal.direction &= 3; - peep->pathfind_history[i].x = static_cast(loc.x); - peep->pathfind_history[i].y = static_cast(loc.y); - peep->pathfind_history[i].z = loc.z; - peep->pathfind_history[i].direction = permitted_edges; + peep->PathfindHistory[i].x = static_cast(loc.x); + peep->PathfindHistory[i].y = static_cast(loc.y); + peep->PathfindHistory[i].z = loc.z; + peep->PathfindHistory[i].direction = permitted_edges; /* Remove the chosen_edge from those left to try. */ - peep->pathfind_history[i].direction &= ~(1 << chosen_edge); + peep->PathfindHistory[i].direction &= ~(1 << chosen_edge); /* Also remove the edge through which the peep * entered the junction from those left to try. */ - peep->pathfind_history[i].direction &= ~(1 << direction_reverse(peep->direction)); + peep->PathfindHistory[i].direction &= ~(1 << direction_reverse(peep->direction)); #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (gPathFindDebug) { @@ -2147,7 +2147,7 @@ int32_t guest_path_finding(Guest* peep) if (direction == INVALID_DIRECTION) { /* Heuristic search failed for all directions. - * Reset the pathfind_goal - this means that the pathfind_history + * Reset the pathfind_goal - this means that the PathfindHistory * will be reset in the next call to peep_pathfind_choose_direction(). * This lets the heuristic search "try again" in case the player has * edited the path layout or the mechanic was already stuck in the diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 51eb28a583..40ca0ac150 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -699,7 +699,7 @@ struct Peep : SpriteBase uint8_t photo1_ride_ref; uint32_t peep_flags; rct12_xyzd8 pathfind_goal; - rct12_xyzd8 pathfind_history[4]; + rct12_xyzd8 PathfindHistory[4]; uint8_t NoActionFrameNum; // 0x3F Litter Count split into lots of 3 with time, 0xC0 Time since last recalc uint8_t LitterCount; diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index 1fb519a1c7..e49ecff526 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -875,7 +875,7 @@ static uint8_t staff_mechanic_direction_path(Peep* peep, uint8_t validDirections if (pathfindDirection == INVALID_DIRECTION) { /* Heuristic search failed for all directions. - * Reset the pathfind_goal - this means that the pathfind_history + * Reset the pathfind_goal - this means that the PathfindHistory * will be reset in the next call to peep_pathfind_choose_direction(). * This lets the heuristic search "try again" in case the player has * edited the path layout or the mechanic was already stuck in the diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index a9232fcf98..96be9026b8 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1213,9 +1213,9 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->photo1_ride_ref = src->photo1_ride_ref; dst->peep_flags = src->peep_flags; dst->pathfind_goal = src->pathfind_goal; - for (size_t i = 0; i < std::size(src->pathfind_history); i++) + for (size_t i = 0; i < std::size(src->PathfindHistory); i++) { - dst->pathfind_history[i] = src->pathfind_history[i]; + dst->pathfind_history[i] = src->PathfindHistory[i]; } dst->no_action_frame_num = src->NoActionFrameNum; dst->litter_count = src->LitterCount; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 43b7238b26..61c629f045 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1480,7 +1480,7 @@ public: dst->pathfind_goal = src->pathfind_goal; for (size_t i = 0; i < std::size(src->pathfind_history); i++) { - dst->pathfind_history[i] = src->pathfind_history[i]; + dst->PathfindHistory[i] = src->pathfind_history[i]; } dst->NoActionFrameNum = src->no_action_frame_num; dst->LitterCount = src->litter_count; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 763f412ae5..0aff08721e 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -238,10 +238,10 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(pathfind_goal.direction); for (int i = 0; i < 4; i++) { - COMPARE_FIELD(pathfind_history[i].x); - COMPARE_FIELD(pathfind_history[i].y); - COMPARE_FIELD(pathfind_history[i].z); - COMPARE_FIELD(pathfind_history[i].direction); + COMPARE_FIELD(PathfindHistory[i].x); + COMPARE_FIELD(PathfindHistory[i].y); + COMPARE_FIELD(PathfindHistory[i].z); + COMPARE_FIELD(PathfindHistory[i].direction); } COMPARE_FIELD(NoActionFrameNum); COMPARE_FIELD(LitterCount);