Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gameengine): let scripted Chinook reinforcements land and unload

Olcay Seygan4e780d3b47fa
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b19397b5b..12910dd84 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -196,6 +196,7 @@ found and fixed — EA's own, not port damage.**
- Repaired aircraft fly to the rally point instead of hovering over the pad.
- Infantry leaving a captured building follow its rally point too.
- A Chinook unloads its passengers one at a time, not stacked in one frame.
+- Campaign reinforcements flown in by Chinook land again. That one-at-a-time unloading sent a mission's scripted Chinooks home with their cargo still aboard, so on the second American mission the dozers announced at the docks never got off, and neither did the next one.
- A guarding unit no longer fights itself between returning to post and shooting back.
- Engineers can clear mines and booby traps they cannot see.
- A helicopter no longer boards a transport from the air.
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 ed3fe240e..0113527fe 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp
@@ -1346,9 +1346,12 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms)
// the evac state below unloads the whole hold in one frame. Only take it when the
// container has somebody queued to get in or out; otherwise let the standard move
- // command through, which unloads one passenger at a time.
+ // command through, which unloads one passenger at a time. Never for the _AND_EXIT form a
+ // script reinforcement uses: the standard state asks to land while it is locked, is refused,
+ // and flies the Chinook home to be deleted with everyone still aboard.
const ContainModuleInterface* contain = getObject()->getContain();
- const Bool allowExit = contain && contain->hasObjectsWantingToEnterOrExit();
+ const Bool allowExit = parms->m_cmd == AICMD_MOVE_TO_POSITION_AND_EVACUATE_AND_EXIT ||
+ (contain && contain->hasObjectsWantingToEnterOrExit());
if (calcDistSqr(*getObject()->getPosition(), parms->m_pos) > THRESH_SQR &&
m_flightStatus == CHINOOK_LANDED)