Skip to content

unify(pathfinder): Merge PathfindLayer::doDebugIcons(), Pathfinder::Classify functions, Pathfinder::checkDestination() and Pathfinder::checkForMovement()#2414

Merged
xezon merged 2 commits intoTheSuperHackers:mainfrom
Mauller:Mauller/unify-pathfinder-classify-functions
Mar 7, 2026
Merged

unify(pathfinder): Merge PathfindLayer::doDebugIcons(), Pathfinder::Classify functions, Pathfinder::checkDestination() and Pathfinder::checkForMovement()#2414
xezon merged 2 commits intoTheSuperHackers:mainfrom
Mauller:Mauller/unify-pathfinder-classify-functions

Conversation

@Mauller
Copy link

@Mauller Mauller commented Mar 6, 2026

This PR merges the next block of functions.

PathfindLayer::doDebugIcons() inherits the Zero Hour implementation.

Pathfinder::classifyCells(), PathfindLayer::classifyLayerMapCell() and PathfindLayer::classifyWallMapCell() have small conditional cahnges that are required for Generals to not mismatch with retail.

Pathfinder::classifyFence, Pathfinder::classifyObjectFootprint and Pathfinder::internal_classifyObjectFootprint have heavy amounts of conditional compilation within them due to significant changes from Generals to Zero Hour.

Pathfinder::checkDesination() and Pathfinder::checkForMovement() only have smaller changes.

I stopped at this point as going further requires dragging in all of the rest of the merge worth of changes and would be too much in this one.

This PR can be squash merged

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

greptile-apps bot commented Mar 6, 2026

Greptile Summary

This PR introduces conditional-compilation guards (#if RTS_GENERALS && RETAIL_COMPATIBLE_PATHFINDING) across PathfindLayer::doDebugIcons(), the Pathfinder::classify* family, checkDestination(), and checkForMovement() to unify the Generals and Zero Hour source trees while keeping each game's retail-compatible behaviour correct.

Key changes:

  • doDebugIcons() in Generals inherits the ZH flashing debug-icon behaviour (static Int flash) and uses a per-cell size variable instead of the fixed 0.8f scale factor; empty now defaults to false so every cell renders a (small) icon.
  • Bridge-layer cell-type assignments (CELL_IMPASSABLE vs CELL_BRIDGE_IMPASSABLE, CELL_CLIFF vs CELL_BRIDGE_IMPASSABLE) are now split by build macro in both files.
  • classifyFence and internal_classifyObjectFootprint in the non-retail-compat path now track per-cell zone dirtying incrementally and call updateZonesForModify only when something changed, rather than always calling markZonesDirty up-front.
  • checkDestination adds an IS_IMPASSABLE early-out for the non-retail-compat path; checkForMovement() branches are properly gated by conditional compilation.
  • Newly introduced single-line if bodies in doDebugIcons() and the cellBounds tracking loops violate the project style guide and should place bodies on their own lines for debugger breakpoint placement.

Confidence Score: 4/5

  • Safe to merge after style violations are corrected; well-structured conditional-compilation unification with no logic errors.
  • The ZH file changes are well-structured reorganisations with no behavioural delta. The Generals file correctly gates code paths via conditional compilation. Minor style violations (single-line if bodies) are the only issue requiring correction before merge.
  • Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp — style violations in doDebugIcons() and cellBounds tracking loops (lines 3327–3328, 4160–4163, 4343–4346, 4414–4417).

Last reviewed commit: 72f9a0d

@Mauller Mauller changed the title unify(pathfinder): Merge PathfindLayer::doDebugIcons(), Pathfinder::Classify functions, Pathfinder::checkDesination() and Pathfinder::checkForMovement() unify(pathfinder): Merge PathfindLayer::doDebugIcons(), Pathfinder::Classify functions, Pathfinder::checkDesyination() and Pathfinder::checkForMovement() Mar 6, 2026
@Mauller Mauller changed the title unify(pathfinder): Merge PathfindLayer::doDebugIcons(), Pathfinder::Classify functions, Pathfinder::checkDesyination() and Pathfinder::checkForMovement() unify(pathfinder): Merge PathfindLayer::doDebugIcons(), Pathfinder::Classify functions, Pathfinder::checkDestination() and Pathfinder::checkForMovement() Mar 6, 2026
@xezon xezon merged commit 41a848c into TheSuperHackers:main Mar 7, 2026
47 of 48 checks passed
@xezon xezon deleted the Mauller/unify-pathfinder-classify-functions branch March 7, 2026 13:21
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.

2 participants