From b80a65364dec137997a2b6306aa89da6489df20a Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 19 Nov 2025 22:05:58 +1100 Subject: [PATCH 1/2] bugfix: Preserve unit behaviour when transferring assets to allies --- .../Code/GameEngine/Source/GameLogic/Object/Object.cpp | 7 +++++++ .../Code/GameEngine/Source/GameLogic/Object/Object.cpp | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 60b5214dbc..3e17c73c0e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -3998,7 +3998,14 @@ void Object::onCapture( Player *oldOwner, Player *newOwner ) { // Everybody dhills when they captured so they don't keep doing something the new player might not want him to be doing if( getAIUpdateInterface() && (oldOwner != newOwner) ) + { +#if RETAIL_COMPATIBLE_CRC getAIUpdateInterface()->aiIdle(CMD_FROM_AI); +#else + if (oldOwner->getRelationship(newOwner->getDefaultTeam()) != ALLIES) + getAIUpdateInterface()->aiIdle(CMD_FROM_AI); +#endif + } // this gets the new owner some points newOwner->getScoreKeeper()->addObjectCaptured(this); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index f65afacd15..b3a0485c5d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -4519,7 +4519,14 @@ void Object::onCapture( Player *oldOwner, Player *newOwner ) { // Everybody dhills when they captured so they don't keep doing something the new player might not want him to be doing if( getAIUpdateInterface() && (oldOwner != newOwner) ) + { +#if RETAIL_COMPATIBLE_CRC getAIUpdateInterface()->aiIdle(CMD_FROM_AI); +#else + if (oldOwner->getRelationship(newOwner->getDefaultTeam()) != ALLIES) + getAIUpdateInterface()->aiIdle(CMD_FROM_AI); +#endif + } // this gets the new owner some points newOwner->getScoreKeeper()->addObjectCaptured(this); From fd969b0e155fd33f7df779175dfff0126609eb34 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Mon, 22 Dec 2025 08:40:05 +1100 Subject: [PATCH 2/2] docs: Add comments --- Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp | 3 ++- GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 3e17c73c0e..eee44de2ea 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -3996,7 +3996,8 @@ void Object::removeUpgrade( const UpgradeTemplate *upgradeT ) //------------------------------------------------------------------------------------------------- void Object::onCapture( Player *oldOwner, Player *newOwner ) { - // Everybody dhills when they captured so they don't keep doing something the new player might not want him to be doing + // Everybody chills when they captured so they don't keep doing something the new player might not want him to be doing + // TheSuperHackers @tweak Stubbjax 19/11/2025 Except when the new owner is an ally, so that Hackers keep on hacking, etc. if( getAIUpdateInterface() && (oldOwner != newOwner) ) { #if RETAIL_COMPATIBLE_CRC diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index b3a0485c5d..8cff59b5d0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -4517,7 +4517,8 @@ void Object::removeUpgrade( const UpgradeTemplate *upgradeT ) //------------------------------------------------------------------------------------------------- void Object::onCapture( Player *oldOwner, Player *newOwner ) { - // Everybody dhills when they captured so they don't keep doing something the new player might not want him to be doing + // Everybody chills when they captured so they don't keep doing something the new player might not want him to be doing + // TheSuperHackers @tweak Stubbjax 19/11/2025 Except when the new owner is an ally, so that Hackers keep on hacking, etc. if( getAIUpdateInterface() && (oldOwner != newOwner) ) { #if RETAIL_COMPATIBLE_CRC