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 guarding aircraft take enemies in fog again

Olcay Seygan83258bec4900
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c20a9d1d2..6eb024c9b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -292,6 +292,7 @@ found and fixed — EA's own, not port damage.**
- 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.
- Guard covers the circle you choose. How far a guard reached used to come from each unit's own eyesight, so Rangers and Missile Defenders posted on the same spot held circles of 180 and 270 and a raider standing between the two was only shot by half the group. Now one guard order gives the whole group one circle, the widest any of them had. Roll the mouse wheel while the guard key or the guard button is armed and the circle grows or shrinks before you click, drawn on the ground under the pointer as you go. Select a guarding group and its circle is drawn round the post, and every unit of yours on guard carries a small steel shield over its head, selected or not, in place of the blocky "G" it used to wear.
+- Jets on guard attack what is inside the circle you drew. A plane on guard flies to its post and circles it, and since guards stopped shooting at enemies hidden in fog it only went after what that loop brought into its own sight: a Raptor guarding a circle of 700 hung over the post for the whole 80 seconds of the test with a power plant 550 out, and an Aurora circled for ten seconds before it found the same one. Aircraft are back on the original rule and take anything in the circle, fog or not. The Raptor's first missiles now land 11 seconds after the order and the Aurora's bomb after 9, and neither flies over the post first. Ground units still leave alone what they cannot see. A replay recorded before this change plays back differently.
- Search and destroy, a new order on F, sends the group round a circle you pick with the wheel, fighting everything it meets on the way, and leaves it guarding that circle when the lap is done. The lap starts on the side the group is coming from and skips ground you can already see. Where F is taken by a unit's own buttons the key moves to the next free place, and a card says what it does when you point at it.
- H now sets a stance for the group. Defensive is how your units have always behaved: they fire on what comes into range and stay put. Aggressive lets them go after anything they can see, the way the computer's own units do, so a group left on aggressive clears the ground around it without being told. The button shows the stance the selection holds.
- A queued attack move finishes its fights before the next order on the list goes out. The first enemy it met used to count as arriving, so a list of attack moves round a town skipped ahead a step at every skirmish and the group was off to the last point while the first was still contested. Replays recorded before this version play back differently.
@@ -924,7 +925,7 @@ A third pass went through the generals' powers, promotions and unit abilities.
- Loading a save of a map with its own map.ini no longer crashes.
- A Dragon Tank firing at a bunker on a hill hits it. Every missile fired uphill from a raised barrel used to be aimed twice and flew over the target.
- A Missile Defender grouped with Rangers keeps its laser lock after you give the group the flashbang.
-- Units in guard mode no longer chase enemies they cannot see through the fog, and a Helix or Comanche no longer keeps its engine noise playing after it flies into the fog.
+- Ground units in guard mode no longer chase enemies they cannot see through the fog, and a Helix or Comanche no longer keeps its engine noise playing after it flies into the fog.
- Infantry can climb into a Helix that is guarding or attacking; it lands for them.
- A worker or dozer sent into a Tunnel Network stays inside instead of walking back out to the foundation it was headed for. Loaded workers stop building from inside, and a builder called off halfway stops the construction noise.
- A Bunker Buster or Neutron Shell on a tunnel's scaffold no longer hits everyone hiding in your tunnel network.
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp
index dfa32606b..d180112b0 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp
@@ -284,7 +284,11 @@ Bool AIGuardMachine::lookForInnerTarget(void)
filters[count++] = &filterMapStatus;
// A guard used to lock onto enemies standing in fog, which every other auto-target refuses
// (getNextMoodTarget's UNFOGGED). It picks from what its player can see now.
- filters[count++] = &filterFogged;
+ // Aircraft keep EA's rule: a guarding plane flies to the post and circles it, so it sees only
+ // its own sight radius of a circle that can be 800 wide, and an enemy at the edge was never
+ // taken. It reveals whatever it flies at anyway.
+ if (!owner->isKindOf(KINDOF_AIRCRAFT))
+ filters[count++] = &filterFogged;
Real visionRange = AIGuardMachine::getGuardRange(owner);