Skip to content

bugfix(pathfinder): Restore retail compatibility after crash fix changes to Pathfinder::findAttackPath - #3289

Open
Caball009 wants to merge 1 commit into
TheSuperHackers:mainfrom
Caball009:Caball009/restore_retail_comp_findAttackPath
Open

bugfix(pathfinder): Restore retail compatibility after crash fix changes to Pathfinder::findAttackPath#3289
Caball009 wants to merge 1 commit into
TheSuperHackers:mainfrom
Caball009:Caball009/restore_retail_comp_findAttackPath

Conversation

@Caball009

@Caball009 Caball009 commented Sep 13, 2026

Copy link
Copy Markdown

#994 introduced a minor Generals specific mistake that causes some replays to mismatch. Here's one such replay: replay.zip


Original code:

Path *path = buildActualPath( obj, locomotorSet.getValidSurfaces(), obj->getPosition(), parentCell, centerInCell, false);
parentCell->releaseInfo();
if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) {
goalCell->releaseInfo();
}
cleanOpenAndClosedLists();

Path *path = buildActualPath( obj, locomotorSet.getValidSurfaces(), obj->getPosition(), parentCell, centerInCell, false);
if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) {
goalCell->releaseInfo();
}
cleanOpenAndClosedLists();

Notice how only the Generals code contains parentCell->releaseInfo().

Current code:

Path *path = buildActualPath( obj, locomotorSet.getValidSurfaces(), obj->getPosition(), parentCell, centerInCell, false);
#if RETAIL_COMPATIBLE_PATHFINDING
if (!s_useFixedPathfinding) {
if (goalCell->hasInfo() && !goalCell->getClosed() && !goalCell->getOpen()) {
goalCell->releaseInfo();
}
cleanOpenAndClosedLists();
}
else
#endif

The current (retail compatible) code doesn't have parentCell->releaseInfo(), even though it should for Generals.

@Caball009 Caball009 added Bug Something is not working right, typically is user facing Major Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ThisProject The issue was introduced by this project, or this task is specific to this project labels Sep 13, 2026
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Restore Generals retail-compatible attack path cleanup

🐞 Bug fix 🕐 Less than 10 minutes

Grey Divider

AI Description

• Restores Generals-specific parent-cell cleanup in retail-compatible attack pathfinding.
• Preserves Zero Hour behavior while preventing Generals replay mismatches.
Diagram

graph TD
  A["Find attack path"] --> B{"Retail mode?"} -->|Legacy| C{"Generals build?"} -->|Yes| D["Release parent info"] --> E["Release goal info"] --> F["Clean path lists"]
  C -->|No| E
  B -->|Fixed| F
Loading
High-Level Assessment

The compile-time RTS_GENERALS guard is the appropriate approach because it precisely restores the original Generals-only cleanup semantics without changing Zero Hour behavior. Unconditional release or runtime title detection would broaden the behavioral change unnecessarily.

Files changed (1) +4 / -0

Bug fix (1) +4 / -0
AIPathfind.cppRestore Generals parent-cell cleanup in legacy pathfinding +4/-0

Restore Generals parent-cell cleanup in legacy pathfinding

• Releases parent-cell pathfinding information when using retail-compatible pathfinding in Generals builds. The RTS_GENERALS guard preserves the distinct Zero Hour cleanup behavior and restores replay compatibility.

Core/GameEngine/Source/GameLogic/AI/AIPathfind.cpp

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can start a comment with 'qodo' or '@qodo' to chat about any finding

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@greptile-apps

greptile-apps Bot commented Sep 13, 2026

Copy link
Copy Markdown

Greptile Summary

This PR restores the original Generals-specific cleanup behavior in Pathfinder::findAttackPath.

  • Releases the successful search’s parent-cell information in retail-compatible Generals pathfinding mode.
  • Leaves Zero Hour and fixed-pathfinding behavior unchanged.
  • Preserves safe cleanup ordering because the parent cell is no longer linked into the open or closed lists at this point.

Confidence Score: 5/5

The PR appears safe to merge and correctly scopes the compatibility restoration to Generals retail pathfinding.

The new release operates on an unlinked parent cell, handles possible goal-cell aliasing safely through the existing information check, and does not alter Zero Hour or fixed-pathfinding execution.

Important Files Changed

Filename Overview
Core/GameEngine/Source/GameLogic/AI/AIPathfind.cpp Adds the missing Generals-only parent-cell information release to the retail-compatible attack-path success branch.

Reviews (1): Last reviewed commit: "bugfix(pathfinder): Restore Generals ret..." | Re-trigger Greptile

@Mauller Mauller 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.

Is good, already gone over this with @Caball009

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Gen Relates to Generals Major Severity: Minor < Major < Critical < Blocker ThisProject The issue was introduced by this project, or this task is specific to this project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants