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(gamelogic): three orders that outlived the thing that gave them
Olcay Seygane6c5a8fb8ec4
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d165a0636..551500eb7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -206,12 +206,18 @@ found and fixed — EA's own, not port damage.**- Dozers and workers walk through anything still going up, so they never shut themselves in behindtheir own work.- The stop button prints its key on it, like the build buttons do.+- A captured worker stops working for its old owner. Being captured cleared its orders but not its+ job, so it carried on building and repairing for the player who just lost it.## Bonuses that come and go when they should- Horde, nationalism and fanaticism bonuses now leave with the horde.- Fanaticism works without nationalism being bought first.- Two battle plans stack properly, and plans move with a captured strategy center.+- The Bombardment Cannon cannot be fired in the middle of a battle plan change. The turret was only+ switched off once it had finished swinging back, so the whole swing was still a firing window.+- Passengers do not step out of a transport that is itself inside something. They would have+ appeared inside whatever was carrying it.## Weapons and units that were quietly wrongdiff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cppindex e310e4de4..99e429722 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp@@ -573,6 +573,11 @@ Bool TransportContain::isSpecificRiderFreeToExit(Object* specificObject)if (ai && ai->getAiFreeToExit(specificObject) != FREE_TO_EXIT)return FALSE;+ // If this transport is itself inside something, its passengers have nowhere to step out to -+ // they would appear inside whatever is carrying us.+ if (me->isContained())+ return FALSE;+// I can always kick people out if I am in the air, I know what I'm doingif (me->isUsingAirborneLocomotor())return TRUE;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cppindex ee71081c7..71360d073 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp@@ -4637,8 +4637,20 @@ 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 doingif( getAIUpdateInterface() && (oldOwner != newOwner) )+ {getAIUpdateInterface()->aiIdle(CMD_FROM_AI);+ // Going idle stops what a unit is doing, but a builder's job is not held in its AI state -+ // it is held in the dozer task list, so a captured worker carried on building or repairing+ // for its old owner. Drop the tasks with the orders.+ DozerAIInterface *dozerAI = getAIUpdateInterface()->getDozerAIInterface();+ if( dozerAI )+ {+ for( UnsignedInt task = DOZER_TASK_FIRST; task < DOZER_NUM_TASKS; ++task )+ dozerAI->cancelTask( (DozerTask)task );+ }+ }+// this gets the new owner some pointsnewOwner->getScoreKeeper()->addObjectCaptured(this);diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cppindex 0c43a4c49..cc8bc3791 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp@@ -396,6 +396,11 @@ UpdateSleepTime BattlePlanUpdate::update(){//It's not centered, and not trying to center, so order it to center.ai->aiIdle( CMD_FROM_AI );+ // The turret is only switched off once it has finished centring, so+ // through the whole swing back it could still be fired - which is+ // how the Bombardment Cannon went off in the middle of a battle+ // plan change.+ enableTurret( false );recenterTurret();m_centeringTurret = true;}