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): no ai idle while a save loads, the brown-out crash on load
Olcay Seygan8bba569d7db7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 47d74ec6f..910d2e540 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -216,6 +216,7 @@ found and fixed — EA's own, not port damage.**- A unit that was driving somewhere when you saved is still driving there when you load. One flag was written to the save twice and another not at all, so every loaded unit came back claiming to stand still, and everything that asks - a bike waiting for its rider, a mob following its leader, an ability that breaks if you move - believed it.- A game saved after losing a supply center loads again. When a truck looked for somewhere to drop its cash and found a center that had been destroyed, it took the center off one list and counted it off the other, so the save recorded the wrong number of supply docks and could not be read back.- Your units decide the same way on both machines whether to chase what they spotted on their own. That answer was read from uninitialised memory, so the same order could send one player's tank after a target and leave the other's standing.+- A game saved with Gattling Cannons or Patriot batteries built past your power plants loads again. The load gives each building its power back one at a time, so the base ran short for a moment halfway through, and switching the defences off in that moment closed the game with "sleepy update module illegal index". Defences come back from a save in exactly the state you left them.- A shell already in the air finishes its flight after a load instead of going off in the launcher's face. It keeps the launcher's veterancy bonus too, and a smart bomb keeps homing.- Supply trucks queued at a dock carry on after a load. Their place in the queue was written to the save and never read back, so every dock stopped letting anyone in until a thirty-second timeout sent the trucks round again.- A cargo plane or bomber on its way off the map at save time flies on after a load. Its heading was not saved, so the first turn read as a sharp one and the plane was destroyed where it was.diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cppindex c92e0e538..3828a9ba6 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp@@ -2286,7 +2286,13 @@ void Object::setDisabledUntil( DisabledType type, UnsignedInt frame )// A building's AI does not run while it is EMPed, hacked, subdued or out of power, so the attack it// was in never exited and kept its look: a Gattling Cannon spun its barrels through the whole EMP.// Selling a building idles it the same way, and it picks a target again once it is back.- if( isAIHaltedByDisable() )+ // Not while a save is loading. A save adds each building's power back as the building comes back,+ // oldest first, so a base that once built past its plants runs short partway through the load+ // and switches off the buildings already restored. Their update modules go back on the sleepy+ // list only once every object is in, and idling one before that woke a module the list did not+ // hold: "sleepy update module illegal index", a player's crash on Load. The AI state each was+ // saved in is what the load leaves it in.+ if( isAIHaltedByDisable() && !TheGameState->isInLoadGame() ){m_ai->stopTurretsTurning();if( isKindOf( KINDOF_STRUCTURE ) )