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): a hacker at work ignores a repeat hack order

Olcay Seygan5f319e6c3700
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bd2f4682b..cbed0aa04 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -541,6 +541,7 @@ found and fixed — EA's own, not port damage.**
- Workers stop hesitating on their way in and out. A dock has a queue outside it and a worker treated its place in that queue as a destination: it drove to the spot, stopped dead, waited a frame, drove to the door, stopped again, and only then went in - twice a load, and nearly every load with nothing else queued. With the dock empty it drives straight in. The first version of that also skipped the walk to a supply pile or a GLA stash, which have no door of their own, so a worker a long way off played its loading animation where it stood and was paid anyway. In a four-player test match 72 loads were picked up or dropped off away from the dock, one of them 613 feet from it; now there are none.
- Hackers show how far off the next payout is. So do the black market and the oil derricks.
- A hacker working from inside an Internet Center shows what it earns. The green figure floats over the building on every payout, the way it does over one sitting in the field. It never appeared, because the game asked the hacker whether it could be seen and a garrisoned unit is not drawn at all - which is the one place a hacker is meant to work.
+- A hacker already at work stays at work when you tell a group of hackers to hack. It used to fold its laptop away and set it up again, and the payout it was halfway to started over from nothing. One that is packing up takes the order and unpacks again. Replays recorded before this change play out differently.
- Factories take a hundred units in the queue, not nine. The build queue only ever had nine buttons and that had become the limit.
- A match can pay everyone a wage. `MoneyPerMinute` in `GameData.ini` drops the same sum into every
living player's account on the minute, on top of whatever they are mining, which is the knob a
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp
index d37fea73c..de7030388 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp
@@ -132,6 +132,13 @@ void HackInternetAIUpdate::aiDoCommand(const AICommandParms* parms)
if (!isAllowedToRespondToAiCommands(parms))
return;
+ // A hacker already at work, or unpacking to start, ignores a repeat hack order. Without this a
+ // hack order given to a selection with one idle hacker in it packed up every busy one and
+ // started it again from nothing. A hacker packing up still takes it, which cancels the pack.
+ if( parms->m_cmd == AICMD_HACK_INTERNET &&
+ ( getStateMachine()->getCurrentStateID() == HACK_INTERNET || getStateMachine()->getCurrentStateID() == UNPACKING ) )
+ return;
+
//If our hacker is currently packing up his gear, we need to prevent him
//from moving until completed. In order to accomplish this, we'll detect,
//then