Fix skirmish AI buildability check passing wrong template (#2407)#2837
Open
mohamedelabbas1996 wants to merge 1 commit into
Open
Conversation
…rHackers#2407) In processBaseBuilding's build-list scan, canMakeUnit() was passed the accumulated candidate template 'bldgPlan' (still null at that point in the loop) instead of the current entry's template 'curPlan'. This made the buildability gate fail for build-list entries that rely on AutomaticallyBuild=Yes (or the default value when the field is omitted), so the skirmish AI never selected those structures. Pass curPlan instead. Applies to both Generals and Zero Hour. Fixes TheSuperHackers#2407
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2407.
In
AISkirmishPlayer::processBaseBuilding(), the build-list scan passes the accumulated candidate templatebldgPlantoTheBuildAssistant->canMakeUnit()— but at that point in the loopbldgPlanis stillnullptr. It should pass the current entry's template,curPlan.Because the check ran against the wrong (null) template, the buildability gate rejected build-list entries that rely on
AutomaticallyBuild = Yes(or the default value when the field is omitted, i.e.m_automaticallyBuild = true), so the skirmish AI never selected those structures to build.Change
canMakeUnit(dozer, bldgPlan)→canMakeUnit(dozer, curPlan)in the build-list loop, with an explanatory comment. Applied to bothGenerals/andGeneralsMD/(the issue affects both games).Notes
This is the first of the two interacting issues described in #2407 (the wrong-template buildability gate). The second (GLA rebuild-hole
bldgshadowing) is left for a separate change.🤖 Generated with Claude Code