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.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
fix(gameengine): hold the assault transport while its squad is still alive
Olcay Seygane3dd4b1c4847
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex a3bd1a163..2f9968029 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -39,7 +39,7 @@ found and fixed — EA's own, not port damage.**- Troop Crawlers wait for their squad to climb back in, up to ten seconds.- Their squad stays out until the area is clear, instead of piling back in after every kill.- Every man aboard gets out to fight; nobody sits out the battle waiting to be patched up.-- An emptied Crawler carries on with your order instead of idling behind the fight.+- A Crawler that has lost its whole squad carries on with your order instead of idling.- Attack-move state is saved now, instead of coming back as random memory.## Your units stop shooting corpsesdiff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cppindex 704330972..e97c201be 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp@@ -64,10 +64,12 @@ Bool AssaultTransport_shouldRetrieveMembers( Bool membersOutside, Bool membersFi//-------------------------------------------------------------------------------------------------/** Is the transport standing there attacking with nobody left to put on the ground?- * Its own weapon only deploys troops, so once it is empty the attack is theatre - drive on. */-Bool AssaultTransport_nothingLeftToDeploy( Bool isAttacking, Bool anyoneInside )+ * Its own weapon only deploys troops, so once it is empty the attack is theatre - drive on.+ * Not while the squad it dropped is still alive out there, though: that fight is the whole+ * point of having stopped, and driving off would leave them chasing the transport. */+Bool AssaultTransport_nothingLeftToDeploy( Bool isAttacking, Bool anyoneInside, Bool membersAlive ){- return isAttacking && !anyoneInside;+ return isAttacking && !anyoneInside && !membersAlive;}//-------------------------------------------------------------------------------------------------@@ -265,8 +267,10 @@ UpdateSleepTime AssaultTransportAIUpdate::update( void )}//Nobody left to put on the ground: stop posing with the deploy weapon and get on with the order.+ //m_currentMembers only counts our living troops, so with the hold empty they are all outside.if( AssaultTransport_nothingLeftToDeploy( transport->testStatus( OBJECT_STATUS_IS_ATTACKING ),- contain && contain->getContainCount() > 0 ) )+ contain && contain->getContainCount() > 0,+ m_currentMembers > 0 ) ){if( m_isAttackMove && getAIStateType() != AI_ATTACK_MOVE_TO ){diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex 43b57b060..81b9a6ab2 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -785,19 +785,22 @@ TEST(ctrl_is_force_fire_only_while_the_attack_move_cursor_is_down)orders now board on this one rule. */extern Bool AssaultTransport_shouldRetrieveMembers( Bool membersOutside, Bool membersFighting, Bool areaClear );extern Bool AssaultTransport_waitingForBoarding( Bool membersOutside, UnsignedInt framesRemaining );-extern Bool AssaultTransport_nothingLeftToDeploy( Bool isAttacking, Bool anyoneInside );+extern Bool AssaultTransport_nothingLeftToDeploy( Bool isAttacking, Bool anyoneInside, Bool membersAlive );TEST(troop_crawler_drives_on_once_it_is_empty){- /* attacking with an empty hold: the crawler's own weapon only unloads troops, so it is- standing there doing nothing - resume the order instead. */- CHECK( AssaultTransport_nothingLeftToDeploy( true, false ) );+ /* attacking with an empty hold and no squad left alive: the crawler's own weapon only unloads+ troops, so it is standing there doing nothing - resume the order instead. */+ CHECK( AssaultTransport_nothingLeftToDeploy( true, false, false ) );++ /* the squad it dropped is still out there fighting: hold, or they would be left behind. */+ CHECK( !AssaultTransport_nothingLeftToDeploy( true, false, true ) );/* somebody still aboard: stay put, he is about to be deployed. */- CHECK( !AssaultTransport_nothingLeftToDeploy( true, true ) );+ CHECK( !AssaultTransport_nothingLeftToDeploy( true, true, false ) );/* not attacking at all: whatever it is doing is not our business. */- CHECK( !AssaultTransport_nothingLeftToDeploy( false, false ) );+ CHECK( !AssaultTransport_nothingLeftToDeploy( false, false, false ) );}TEST(troop_crawler_picks_its_troops_back_up_only_when_the_fight_is_over)