diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index afb876af064..731c0684fca 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -215,7 +215,12 @@ void AISkirmishPlayer::processBaseBuilding() } continue; } - if (TheBuildAssistant->canMakeUnit(dozer, bldgPlan)!=CANMAKE_OK) { + // TheSuperHackers @bugfix mohamedelabbas1996 Pass the current build-list + // entry (curPlan) to canMakeUnit, not the accumulated candidate (bldgPlan, + // which is still null here). Using bldgPlan made the buildability check fail + // for entries relying on AutomaticallyBuild=Yes (or the default when the + // field is omitted), so the AI never selected them. Fixes issue #2407. + if (TheBuildAssistant->canMakeUnit(dozer, curPlan)!=CANMAKE_OK) { if (info->isBuildable()) { AsciiString bldgName = info->getTemplateName(); bldgName.concat(" - Dozer unable to build - money or technology missing."); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index 0a1a7ea64da..e67c4990590 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -222,7 +222,12 @@ void AISkirmishPlayer::processBaseBuilding() } continue; } - if (TheBuildAssistant->canMakeUnit(dozer, bldgPlan)!=CANMAKE_OK) { + // TheSuperHackers @bugfix mohamedelabbas1996 Pass the current build-list + // entry (curPlan) to canMakeUnit, not the accumulated candidate (bldgPlan, + // which is still null here). Using bldgPlan made the buildability check fail + // for entries relying on AutomaticallyBuild=Yes (or the default when the + // field is omitted), so the AI never selected them. Fixes issue #2407. + if (TheBuildAssistant->canMakeUnit(dozer, curPlan)!=CANMAKE_OK) { if (info->isBuildable()) { AsciiString bldgName = info->getTemplateName(); bldgName.concat(" - Dozer unable to build - money or technology missing.");