Skip to content

Commit b97d954

Browse files
authored
bugfix(aiplayer): Preserve scaffold health when AI building completes (TheSuperHackers#1768)
1 parent 4eac616 commit b97d954

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ void AIPlayer::onStructureProduced( Object *factory, Object *bldg )
121121
Dict d;
122122
d.setAsciiString(TheKey_objectName, info->getBuildingName());
123123
d.setAsciiString(TheKey_objectScriptAttachment, info->getScript());
124+
// TheSuperHackers @bugfix bobtista 31/10/2025 Preserve scaffold health when AI building construction completes instead of resetting to initial health.
125+
#if RETAIL_COMPATIBLE_CRC
124126
d.setInt(TheKey_objectInitialHealth, info->getHealth());
127+
#endif
125128
d.setBool(TheKey_objectUnsellable, info->getUnsellable());
126129

127130
info->setUnderConstruction(false);
@@ -458,7 +461,10 @@ Object *AIPlayer::buildStructureNow(const ThingTemplate *bldgPlan, BuildListInfo
458461
Dict d;
459462
d.setAsciiString(TheKey_objectName, info->getBuildingName());
460463
d.setAsciiString(TheKey_objectScriptAttachment, info->getScript());
464+
// TheSuperHackers @bugfix bobtista 31/10/2025 Preserve scaffold health when AI building construction completes instead of resetting to initial health.
465+
#if RETAIL_COMPATIBLE_CRC
461466
d.setInt(TheKey_objectInitialHealth, info->getHealth());
467+
#endif
462468
d.setBool(TheKey_objectUnsellable, info->getUnsellable());
463469

464470
bldg->updateObjValuesFromMapProperties(&d);

GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ void AIPlayer::onStructureProduced( Object *factory, Object *bldg )
122122
Dict d;
123123
d.setAsciiString(TheKey_objectName, info->getBuildingName());
124124
d.setAsciiString(TheKey_objectScriptAttachment, info->getScript());
125+
// TheSuperHackers @bugfix bobtista 31/10/2025 Preserve scaffold health when AI building construction completes instead of resetting to initial health.
126+
#if RETAIL_COMPATIBLE_CRC
125127
d.setInt(TheKey_objectInitialHealth, info->getHealth());
128+
#endif
126129
d.setBool(TheKey_objectUnsellable, info->getUnsellable());
127130

128131
info->setUnderConstruction(false);
@@ -462,7 +465,10 @@ Object *AIPlayer::buildStructureNow(const ThingTemplate *bldgPlan, BuildListInfo
462465
Dict d;
463466
d.setAsciiString(TheKey_objectName, info->getBuildingName());
464467
d.setAsciiString(TheKey_objectScriptAttachment, info->getScript());
468+
// TheSuperHackers @bugfix bobtista 31/10/2025 Preserve scaffold health when AI building construction completes instead of resetting to initial health.
469+
#if RETAIL_COMPATIBLE_CRC
465470
d.setInt(TheKey_objectInitialHealth, info->getHealth());
471+
#endif
466472
d.setBool(TheKey_objectUnsellable, info->getUnsellable());
467473

468474
bldg->updateObjValuesFromMapProperties(&d);

0 commit comments

Comments
 (0)