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): keep per-unit destinations for alt-queued waypoints

Olcay Seygan5a8c70c86369
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 145651d55..2eaba9e9c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -98,7 +98,7 @@ found and fixed — EA's own, not port damage.**
- A unit turns onto whatever is actually shooting it, then resumes the advance.
- Otherwise it picks the worst thing in range: anything armed before anything that is not, then the more dangerous of the two, and worth fades with distance so it is never the far one it walks the field for. A group ordered through a base no longer stops for the first dozer it passes while the artillery beside it keeps firing.
- Ctrl on the attack-move click no longer shells the ground instead.
-- A big selection arrives as a crowd. Two hundred units told to attack-move used to spread along a line and three hundred told to move mostly stood still: the group tried to hold its shape all the way in. Past forty units everyone now heads for the spot you clicked and takes the nearest free ground to it. Below forty the group keeps its spacing on the way in, because that is what stops a dozen tanks arriving in single file.
+- A big selection arrives as a crowd. Two hundred units told to attack-move used to spread along a line and three hundred told to move mostly stood still: the group tried to hold its shape all the way in. Past forty units everyone now heads for the spot you clicked and takes the nearest free ground to it. Below forty the group keeps its spacing on the way in, because that is what stops a dozen tanks arriving in single file. A waypoint queued with alt is the exception and now keeps every unit's own spot: only the last point of a queued route gets moved to free ground, so sending a dozen tanks through the same intermediate cell left eleven of them unable to reach it, and the group walked to the first waypoint and stopped there.
- Troop Crawlers wait for their squad to climb back in, up to ten seconds.
- One man who cannot get back aboard no longer parks the Crawler for the rest of the attack move.
- Their squad stays out until the area is clear, instead of piling back in after every kill.
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp
index e8c48d6ea..63737ea0c 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp
@@ -1727,7 +1727,13 @@ void AIGroup::groupMoveToPosition( const Coord3D *p_posIn, Bool addWaypoint, Com
// holding a shape. Explicit formations - the ones the player asked for by name - still keep
// theirs, and the AI still moves its teams the old way.
//
- const Bool gatherOnPoint = ( cmdSource == CMD_FROM_PLAYER && !isFormation );
+ // A queued waypoint (alt-click) is the exception, and it has to be: the whole thing rests on the
+ // move state finding a free cell near the spot, and AIFollowPathState only adjusts the *last*
+ // point of the path - every point before it is driven at exactly as given
+ // (setAdjustsDestination(false), AIStates.cpp:3398). Handing a dozen tanks the same intermediate
+ // cell means eleven of them never arrive at it and the queue stops there, which is a group that
+ // walks to the first waypoint and stands. So a queued point keeps each member's own offset.
+ const Bool gatherOnPoint = ( cmdSource == CMD_FROM_PLAYER && !isFormation && !addWaypoint );
/* The group path and the orders that ride on it, timed: it is one search plus a move order for
every member, all of it inside the one logic frame the order arrives on, and a skirmish AI