Skip to content

refactor(pathfinder): Split several individual classes off of AIPathfind.h into separate header files - #3334

Merged
xezon merged 8 commits into
TheSuperHackers:mainfrom
Skyaero42:skyaero/refactor-aipathfind
Sep 25, 2026
Merged

xezon merged 8 commits into
TheSuperHackers:mainfrom
Skyaero42:skyaero/refactor-aipathfind

Conversation

@Skyaero42

@Skyaero42 Skyaero42 commented Sep 21, 2026 •

Copy link
Copy Markdown

This PR extracts several pathfinder header classes from the aipathfind.h header into their own header files to increase readability and maintainability. This is a first step into refactoring the pathfinding code.

  • Background info: Refactor pathfinding code for easier readability and maintainability #3333
  • Each class is extract in its own commit.
  • Classes are included in aipathfind.h, so that the 100+ inclusions of aipathfind.h does not need to be changed. This will be addressed later.
  • Formatting hasn't been touched
  • Forward declaration of classes has been used where possible.
  • The pathfinder class, its interface and remnant definitions remain in aipathfind.h and are left as-is

Todo:

  • Reword commit messages to include PR number

@Skyaero42 Skyaero42 added the Refactor Edits the code with insignificant behavior changes, is never user facing label Sep 21, 2026
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 2741dcaf-92ea-4611-bdef-178e46f1256e

📥 Commits

Reviewing files that changed from the base of the PR and between 47c5e78 and 33bc18d.

📒 Files selected for processing (8)
  • Core/GameEngine/Include/GameLogic/Pathfinder/Path.h
  • Core/GameEngine/Include/GameLogic/Pathfinder/PathNode.h
  • Core/GameEngine/Include/GameLogic/Pathfinder/PathfindCell.h
  • Core/GameEngine/Include/GameLogic/Pathfinder/PathfindCellInfo.h
  • Core/GameEngine/Include/GameLogic/Pathfinder/PathfindCellList.h
  • Core/GameEngine/Include/GameLogic/Pathfinder/PathfindLayer.h
  • Core/GameEngine/Include/GameLogic/Pathfinder/PathfindZoneManager.h
  • Core/GameEngine/Include/GameLogic/Pathfinder/ZoneBlock.h

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

The pathfinding declarations moved from AIPathfind.h into eight dedicated headers. The headers define path, node, cell, layer, zone, and manager interfaces. Include behavior and build metadata were updated.

Changes

Pathfinder header extraction

Layer / File(s) Summary
Path and node interfaces
Core/GameEngine/Include/GameLogic/Pathfinder/Path.h, Core/GameEngine/Include/GameLogic/Pathfinder/PathNode.h
Added Path and PathNode declarations for node management, optimization, queries, serialization, and memory-pool support.
Grid and zone interfaces
Core/GameEngine/Include/GameLogic/Pathfinder/PathfindCell.h, Core/GameEngine/Include/GameLogic/Pathfinder/PathfindCellInfo.h, Core/GameEngine/Include/GameLogic/Pathfinder/PathfindCellList.h, Core/GameEngine/Include/GameLogic/Pathfinder/PathfindLayer.h, Core/GameEngine/Include/GameLogic/Pathfinder/ZoneBlock.h, Core/GameEngine/Include/GameLogic/Pathfinder/PathfindZoneManager.h
Added declarations for pathfinding cells, A* state, layers, zone blocks, and zone management, including retail-compatible conditional APIs.
Header and build integration
Core/GameEngine/Include/GameLogic/AIPathfind.h, Core/GameEngine/CMakeLists.txt
Updated includes and allocation guards, removed embedded pathfinding declarations from AIPathfind.h, and added the new headers to GAMEENGINE_SRC.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Refactor

Suggested reviewers: mauller

Merge Risk: ⚪ Minimal · up to 33bc1

No concrete current-head failure remains established, so this extraction is mergeable with normal checks.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the primary change: splitting pathfinder classes from AIPathfind.h into separate header files.
Description check ✅ Passed The description directly explains the header extraction, compatibility through AIPathfind.h, use of forward declarations, and the planned follow-up work.

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Reorganizes pathfinding classes into separate header files.

The refactor has no established behavioral blocker, but its two explicit repository requirements should be satisfied before merging.

Summary

The PR extracts pathfinding classes into eight headers, includes them through AIPathfind.h to preserve existing consumers, and registers the headers with CMake.

  • The changes since the previous review reorder the common includes ahead of the extracted headers.
  • Two repository comment-format requirements remain to be addressed.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Consumers --> AIPathfind[AIPathfind.h]
  AIPathfind --> Common[Common types and locomotor headers]
  AIPathfind --> Extracted[Pathfinder class headers]
  Extracted --> Cell[PathfindCell and cell info]
  Extracted --> Path[Path and PathNode]
  Extracted --> Zones[Layers and zones]
Loading

Reviews (8) · Last reviewed commit: "refactor(pathfinder): Move PathfindZoneM..."

Comment thread Core/GameEngine/Include/GameLogic/Pathfinder/PathfindCell.h
@Skyaero42
Skyaero42 marked this pull request as draft September 21, 2026 15:03
@Skyaero42
Skyaero42 marked this pull request as ready for review September 21, 2026 15:05

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: d2243ac5-595e-453e-8a9b-356a60944dee

📥 Commits

Reviewing files that changed from the base of the PR and between 710103d and 2bddeec.

📒 Files selected for processing (10)
  • Core/GameEngine/CMakeLists.txt
  • Core/GameEngine/Include/GameLogic/AIPathfind.h
  • Core/GameEngine/Include/GameLogic/Pathfinder/Path.h
  • Core/GameEngine/Include/GameLogic/Pathfinder/PathNode.h
  • Core/GameEngine/Include/GameLogic/Pathfinder/PathfindCell.h
  • Core/GameEngine/Include/GameLogic/Pathfinder/PathfindCellInfo.h
  • Core/GameEngine/Include/GameLogic/Pathfinder/PathfindCellList.h
  • Core/GameEngine/Include/GameLogic/Pathfinder/PathfindLayer.h
  • Core/GameEngine/Include/GameLogic/Pathfinder/PathfindZoneManager.h
  • Core/GameEngine/Include/GameLogic/Pathfinder/ZoneBlock.h

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment thread Core/GameEngine/Include/GameLogic/Pathfinder/PathfindCell.h

@xezon xezon left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this only extract the header part, and not the implementation part?

Is this meant to be merged with rebase or squash?

@Mauller

Mauller commented Sep 22, 2026

Copy link
Copy Markdown

Why does this only extract the header part, and not the implementation part?

To make reviewing easier, the plan is to do the .cpp and any include cleanup after.

@Skyaero42

Copy link
Copy Markdown
Author

Why does this only extract the header part, and not the implementation part?

Is this meant to be merged with rebase or squash?

Makes reviewing easier. There is already a lot going on with the headers alone. The cpp is going to be worse. Se #3333 for the whole plan.

It can be rebased or squashed, that is up to you. If you want to rebase it, I'll add the PR number to the commits.

Comment thread Core/GameEngine/Include/GameLogic/Pathfinder/PathfindCellInfo.h Outdated
Comment thread Core/GameEngine/Include/GameLogic/Pathfinder/PathfindCellInfo.h Outdated
Comment thread Core/GameEngine/Include/GameLogic/Pathfinder/PathfindLayer.h Outdated
Comment thread Core/GameEngine/Include/GameLogic/Pathfinder/PathfindZoneManager.h
@Skyaero42
Skyaero42 force-pushed the skyaero/refactor-aipathfind branch from 47c5e78 to 018dfdf Compare September 22, 2026 19:19
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 22, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 22, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 22, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 22, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 22, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 22, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 22, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 22, 2026
@Skyaero42
Skyaero42 force-pushed the skyaero/refactor-aipathfind branch from 018dfdf to 33bc18d Compare September 22, 2026 19:22
Comment thread Core/GameEngine/Include/GameLogic/Pathfinder/PathfindCellInfo.h
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 22, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 22, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 22, 2026
@Skyaero42
Skyaero42 force-pushed the skyaero/refactor-aipathfind branch from 33bc18d to a03fb96 Compare September 22, 2026 19:39
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 23, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 23, 2026
@Skyaero42
Skyaero42 force-pushed the skyaero/refactor-aipathfind branch from a03fb96 to 1d7b488 Compare September 23, 2026 18:35
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 23, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 23, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 23, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 23, 2026
@Skyaero42
Skyaero42 force-pushed the skyaero/refactor-aipathfind branch from 1d7b488 to e753e94 Compare September 23, 2026 18:37
Comment thread Core/GameEngine/Include/GameLogic/AIPathfind.h Outdated
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 24, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 24, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 24, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 24, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 24, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 24, 2026
Skyaero42 added a commit to Skyaero42/GeneralsGameCode that referenced this pull request Sep 24, 2026
@Skyaero42
Skyaero42 force-pushed the skyaero/refactor-aipathfind branch from e753e94 to f559a41 Compare September 24, 2026 07:32
Comment thread Core/GameEngine/Include/GameLogic/AIPathfind.h
@Skyaero42
Skyaero42 force-pushed the skyaero/refactor-aipathfind branch from f559a41 to b10c861 Compare September 25, 2026 09:27
@xezon xezon changed the title refactor(pathfinder): Extract individual pathfinder classes into their own header files refactor(pathfinder): Split AIPathfind.h into separate header files for individual classes Sep 25, 2026
@xezon xezon changed the title refactor(pathfinder): Split AIPathfind.h into separate header files for individual classes refactor(pathfinder): Split several individual classes off of AIPathfind.h into separate header files Sep 25, 2026
@xezon
xezon merged commit a046a22 into TheSuperHackers:main Sep 25, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Edits the code with insignificant behavior changes, is never user facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants