From 6388b8f345fe47bb78ddaed2ffa9c5a415ba3518 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Mon, 3 Nov 2025 21:44:41 +1100 Subject: [PATCH 1/4] bugfix: Chinooks and Helixes no longer take off after repair if passengers want to board or exit --- .../GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp | 8 ++++++-- .../GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 7c13cab791c..794e31aefc2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1002,9 +1002,15 @@ Bool ChinookAIUpdate::chooseLocomotorSet(LocomotorSetType wst) UpdateSleepTime ChinookAIUpdate::update() { ParkingPlaceBehaviorInterface* pp = getPP(m_airfieldForHealing); + ContainModuleInterface* contain = getObject()->getContain(); + Bool waitingToEnterOrExit = contain && contain->hasObjectsWantingToEnterOrExit(); + if (pp != NULL) { if (m_flightStatus == CHINOOK_LANDED && +#if !RETAIL_COMPATIBLE_CRC + !waitingToEnterOrExit && +#endif !m_hasPendingCommand && getObject()->getBodyModule()->getHealth() == getObject()->getBodyModule()->getMaxHealth()) { @@ -1026,10 +1032,8 @@ UpdateSleepTime ChinookAIUpdate::update() // when we have a pending command... if (SupplyTruckAIUpdate::isIdle()) { - ContainModuleInterface* contain = getObject()->getContain(); if( contain ) { - Bool waitingToEnterOrExit = contain->hasObjectsWantingToEnterOrExit(); if (m_hasPendingCommand) { AICommandParms parms(AICMD_MOVE_TO_POSITION, CMD_FROM_AI); // values don't matter, will be wiped by next line diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index c6fca758211..986332c5099 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1064,9 +1064,15 @@ Bool ChinookAIUpdate::chooseLocomotorSet(LocomotorSetType wst) UpdateSleepTime ChinookAIUpdate::update() { ParkingPlaceBehaviorInterface* pp = getPP(m_airfieldForHealing); + ContainModuleInterface* contain = getObject()->getContain(); + Bool waitingToEnterOrExit = contain && contain->hasObjectsWantingToEnterOrExit(); + if (pp != NULL) { if (m_flightStatus == CHINOOK_LANDED && +#if !RETAIL_COMPATIBLE_CRC + !waitingToEnterOrExit && +#endif !m_hasPendingCommand && getObject()->getBodyModule()->getHealth() == getObject()->getBodyModule()->getMaxHealth()) { @@ -1088,12 +1094,10 @@ UpdateSleepTime ChinookAIUpdate::update() // have to call our parent's isIdle, because we override it to never return true // when we have a pending command... - ContainModuleInterface* contain = getObject()->getContain(); if( contain ) { if (SupplyTruckAIUpdate::isIdle()) { - Bool waitingToEnterOrExit = contain->hasObjectsWantingToEnterOrExit(); if (m_hasPendingCommand) { AICommandParms parms(AICMD_MOVE_TO_POSITION, CMD_FROM_AI); // values don't matter, will be wiped by next line From e94c2359e03d6e7654b0496b42ba7fa580097be4 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sat, 20 Dec 2025 13:00:45 +1100 Subject: [PATCH 2/4] fix: Align indentation --- .../Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp | 2 +- .../Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 794e31aefc2..578dd0fda04 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1009,7 +1009,7 @@ UpdateSleepTime ChinookAIUpdate::update() { if (m_flightStatus == CHINOOK_LANDED && #if !RETAIL_COMPATIBLE_CRC - !waitingToEnterOrExit && + !waitingToEnterOrExit && #endif !m_hasPendingCommand && getObject()->getBodyModule()->getHealth() == getObject()->getBodyModule()->getMaxHealth()) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 986332c5099..50284db2159 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1071,7 +1071,7 @@ UpdateSleepTime ChinookAIUpdate::update() { if (m_flightStatus == CHINOOK_LANDED && #if !RETAIL_COMPATIBLE_CRC - !waitingToEnterOrExit && + !waitingToEnterOrExit && #endif !m_hasPendingCommand && getObject()->getBodyModule()->getHealth() == getObject()->getBodyModule()->getMaxHealth()) From abfd950d831ccb3e2e7e903d9539e02f67f940e9 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sat, 20 Dec 2025 13:04:15 +1100 Subject: [PATCH 3/4] tweak: Assign constants --- .../GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp | 4 ++-- .../GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 578dd0fda04..de3f174400c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1002,8 +1002,8 @@ Bool ChinookAIUpdate::chooseLocomotorSet(LocomotorSetType wst) UpdateSleepTime ChinookAIUpdate::update() { ParkingPlaceBehaviorInterface* pp = getPP(m_airfieldForHealing); - ContainModuleInterface* contain = getObject()->getContain(); - Bool waitingToEnterOrExit = contain && contain->hasObjectsWantingToEnterOrExit(); + const ContainModuleInterface* contain = getObject()->getContain(); + const Bool waitingToEnterOrExit = contain && contain->hasObjectsWantingToEnterOrExit(); if (pp != NULL) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 50284db2159..cd2b328da2b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1064,8 +1064,8 @@ Bool ChinookAIUpdate::chooseLocomotorSet(LocomotorSetType wst) UpdateSleepTime ChinookAIUpdate::update() { ParkingPlaceBehaviorInterface* pp = getPP(m_airfieldForHealing); - ContainModuleInterface* contain = getObject()->getContain(); - Bool waitingToEnterOrExit = contain && contain->hasObjectsWantingToEnterOrExit(); + const ContainModuleInterface* contain = getObject()->getContain(); + const Bool waitingToEnterOrExit = contain && contain->hasObjectsWantingToEnterOrExit(); if (pp != NULL) { From 6f3efe8277f5d1a5993415352372cb20749df9f8 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sat, 20 Dec 2025 13:06:17 +1100 Subject: [PATCH 4/4] docs: Add comments --- .../Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp | 1 + .../Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index de3f174400c..c24c9b6a959 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1009,6 +1009,7 @@ UpdateSleepTime ChinookAIUpdate::update() { if (m_flightStatus == CHINOOK_LANDED && #if !RETAIL_COMPATIBLE_CRC + // TheSuperHackers @bugfix Stubbjax 03/11/2025 Prevent Chinooks from taking off while there are still units wanting to enter or exit. !waitingToEnterOrExit && #endif !m_hasPendingCommand && diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index cd2b328da2b..eaeeffee975 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1071,6 +1071,7 @@ UpdateSleepTime ChinookAIUpdate::update() { if (m_flightStatus == CHINOOK_LANDED && #if !RETAIL_COMPATIBLE_CRC + // TheSuperHackers @bugfix Stubbjax 03/11/2025 Prevent Chinooks from taking off while there are still units wanting to enter or exit. !waitingToEnterOrExit && #endif !m_hasPendingCommand &&