Skip to content

unify(pathfinder): Move AIPathfind.h and AIPathfind.cpp to Core#2428

Merged
xezon merged 1 commit intoTheSuperHackers:mainfrom
Mauller:Mauller/move-aipathfind-to-core
Mar 9, 2026
Merged

unify(pathfinder): Move AIPathfind.h and AIPathfind.cpp to Core#2428
xezon merged 1 commit intoTheSuperHackers:mainfrom
Mauller:Mauller/move-aipathfind-to-core

Conversation

@Mauller
Copy link

@Mauller Mauller commented Mar 8, 2026

This PR finally moves the unified Pathfinding code to core.

Not much else to say. :)

Can finally get back to making pathfinder go brrrrrrrrr.

@Mauller Mauller self-assigned this Mar 8, 2026
@Mauller Mauller added Gen Relates to Generals ZH Relates to Zero Hour Unify Unifies code between Generals and Zero Hour labels Mar 8, 2026
@greptile-apps
Copy link

greptile-apps bot commented Mar 8, 2026

Greptile Summary

This PR completes the unification of the AI pathfinding system by moving AIPathfind.h and AIPathfind.cpp from GeneralsMD/Code/GameEngine to Core/GameEngine, and deleting the now-redundant Generals/Code/GameEngine copies. The three CMakeLists files are updated consistently — Core uncomments the files so they are compiled as part of the shared library, while Generals and GeneralsMD comment them out so each game build defers to the Core version. A pair of tracking comments is also added to scripts/cpp/unify_move_files.py to record the completed move.

Key points:

  • Both the Generals and GeneralsMD versions were confirmed to be identical in content before this PR (same 998-line header and 11 225-line source; only the branding string in the file prologue differed), so no game-specific logic is lost.
  • The Core source retains the existing #if RTS_GENERALS && RETAIL_COMPATIBLE_PATHFINDING compile-time guards, so both game targets continue to compile correctly.
  • The moved files correctly use #pragma once, the GPL license header, and nullptr throughout.
  • scripts/cpp/unify_move_files.py entries are commented out (tracking only), which is consistent with every other already-unified file in that script.

Confidence Score: 5/5

  • This PR is safe to merge — it is a clean, zero-logic-change file move with all three CMakeLists files updated correctly.
  • The moved files are 100% identical to the GeneralsMD originals (verified via git similarity index and line-count comparison). No new code is introduced, no existing guards are removed, and the CMakeLists changes follow the established pattern for previously unified files. No NULL, include-guard, or license-header violations were found.
  • No files require special attention.

Important Files Changed

Filename Overview
Core/GameEngine/Include/GameLogic/AIPathfind.h New unified header moved from GeneralsMD with 100% similarity; uses #pragma once, GPL license, and nullptr throughout. No content changes — purely a rename into Core.
Core/GameEngine/Source/GameLogic/AI/AIPathfind.cpp Source moved from GeneralsMD with 100% similarity; uses RTS_GENERALS compile-time guards throughout for game-specific branches. No content changes introduced by this PR.
Core/GameEngine/CMakeLists.txt Uncomments AIPathfind.h and AIPathfind.cpp entries so the Core build system picks them up; change is minimal and correct.
Generals/Code/GameEngine/CMakeLists.txt Comments out AIPathfind.h and AIPathfind.cpp so the Generals build defers to the Core version; mirrors the pattern of other unified files.
Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h Deleted; content was verified to be identical to the GeneralsMD version (same line count, only header branding differed) so no code is lost.
Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp Deleted; confirmed identical line count (11 225 lines) to the GeneralsMD version before this PR, so no logic is dropped.
GeneralsMD/Code/GameEngine/CMakeLists.txt Comments out AIPathfind.h and AIPathfind.cpp so the Zero Hour build also defers to the Core version; correct and consistent with the pattern.
scripts/cpp/unify_move_files.py Adds two commented-out unify_file tracking entries for AIPathfind.cpp and AIPathfind.h to document the completed unification; no executable code added.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph Before["Before this PR"]
        G_H["Generals/Code/GameEngine/\nInclude/GameLogic/AIPathfind.h"]
        G_C["Generals/Code/GameEngine/\nSource/GameLogic/AI/AIPathfind.cpp"]
        MD_H["GeneralsMD/Code/GameEngine/\nInclude/GameLogic/AIPathfind.h"]
        MD_C["GeneralsMD/Code/GameEngine/\nSource/GameLogic/AI/AIPathfind.cpp"]
    end

    subgraph After["After this PR"]
        CORE_H["Core/GameEngine/\nInclude/GameLogic/AIPathfind.h"]
        CORE_C["Core/GameEngine/\nSource/GameLogic/AI/AIPathfind.cpp"]
        GEN_BUILD["Generals Build\n(CMakeLists commented out\n→ uses Core)"]
        MD_BUILD["GeneralsMD Build\n(CMakeLists commented out\n→ uses Core)"]
        CORE_BUILD["Core Build\n(CMakeLists uncommented)"]
    end

    G_H -- "deleted" --> CORE_H
    MD_H -- "renamed / moved" --> CORE_H
    G_C -- "deleted" --> CORE_C
    MD_C -- "renamed / moved" --> CORE_C

    CORE_BUILD --> CORE_H
    CORE_BUILD --> CORE_C
    GEN_BUILD --> CORE_BUILD
    MD_BUILD --> CORE_BUILD
Loading

Last reviewed commit: 6234d81

Copy link

@Skyaero42 Skyaero42 left a comment

Choose a reason for hiding this comment

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

Yay!

Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

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

Looking good.

@xezon xezon merged commit 6940ae5 into TheSuperHackers:main Mar 9, 2026
24 checks passed
@xezon xezon deleted the Mauller/move-aipathfind-to-core branch March 9, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gen Relates to Generals Unify Unifies code between Generals and Zero Hour ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants