From 56e1f5b0e7c933a55432d02e77ef883c47341609 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Mon, 3 Nov 2025 15:10:09 -0500 Subject: [PATCH] bugfix: Preserve scaffold health when AI building construction completes --- Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp | 6 ++++++ GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp index 29b237702e..ce731212a2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp @@ -121,7 +121,10 @@ void AIPlayer::onStructureProduced( Object *factory, Object *bldg ) Dict d; d.setAsciiString(TheKey_objectName, info->getBuildingName()); d.setAsciiString(TheKey_objectScriptAttachment, info->getScript()); +#if RETAIL_COMPATIBLE_CRC d.setInt(TheKey_objectInitialHealth, info->getHealth()); +#endif + // TheSuperHackers @bugfix bobtista 31/10/2025 Preserve scaffold health when AI building construction completes instead of resetting to initial health. (#1343) d.setBool(TheKey_objectUnsellable, info->getUnsellable()); info->setUnderConstruction(false); @@ -458,7 +461,10 @@ Object *AIPlayer::buildStructureNow(const ThingTemplate *bldgPlan, BuildListInfo Dict d; d.setAsciiString(TheKey_objectName, info->getBuildingName()); d.setAsciiString(TheKey_objectScriptAttachment, info->getScript()); +#if RETAIL_COMPATIBLE_CRC d.setInt(TheKey_objectInitialHealth, info->getHealth()); +#endif + // TheSuperHackers @bugfix bobtista 31/10/2025 Preserve scaffold health when AI building construction completes instead of resetting to initial health. (#1343) d.setBool(TheKey_objectUnsellable, info->getUnsellable()); bldg->updateObjValuesFromMapProperties(&d); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp index 6820d988c6..993dadb29a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp @@ -122,7 +122,10 @@ void AIPlayer::onStructureProduced( Object *factory, Object *bldg ) Dict d; d.setAsciiString(TheKey_objectName, info->getBuildingName()); d.setAsciiString(TheKey_objectScriptAttachment, info->getScript()); +#if RETAIL_COMPATIBLE_CRC d.setInt(TheKey_objectInitialHealth, info->getHealth()); +#endif + // TheSuperHackers @bugfix bobtista 31/10/2025 Preserve scaffold health when AI building construction completes instead of resetting to initial health. (#1343) d.setBool(TheKey_objectUnsellable, info->getUnsellable()); info->setUnderConstruction(false); @@ -462,7 +465,10 @@ Object *AIPlayer::buildStructureNow(const ThingTemplate *bldgPlan, BuildListInfo Dict d; d.setAsciiString(TheKey_objectName, info->getBuildingName()); d.setAsciiString(TheKey_objectScriptAttachment, info->getScript()); +#if RETAIL_COMPATIBLE_CRC d.setInt(TheKey_objectInitialHealth, info->getHealth()); +#endif + // TheSuperHackers @bugfix bobtista 31/10/2025 Preserve scaffold health when AI building construction completes instead of resetting to initial health. (#1343) d.setBool(TheKey_objectUnsellable, info->getUnsellable()); bldg->updateObjValuesFromMapProperties(&d);