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): reseat tunnel riders on a finished mouth
Olcay Seygan2022efeb2a80
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 5a0981fe9..41887472b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -447,7 +447,7 @@ found and fixed — EA's own, not port damage.**- Circular range checks are circles now, not the square drawn around them.- A tunnel network heals at one rate, however many entrances it has.-- GLA units take the tunnels on their own. Give a move order across the map, and if the way through your network is any shorter than the walk, the whole selection goes down the tunnel nearest it and comes up at the one nearest where you sent it, then walks the rest. An attack move does the same and comes up still attack-moving, and fresh units heading for a rally point across the map take the tunnels too, fighting on the way if they would have walked there fighting. The tunnels used to have to be almost a third shorter before anybody took them, so fresh units with a tunnel beside their barracks and one beside the rally point mostly walked anyway. Passing through does not count as resting: only units you put inside yourself are healed. The group decides together: fifteen Rebels with six places already taken all go through, where a first version sent ten underground and walked the other five. The green order line shows it: one line to the tunnel they go down and one from the tunnel they come up at to where you sent them. Twelve Rebels crossing a small map with a tunnel at each end got there in 21 seconds instead of 50, four Scorpions in 9 instead of 21. A tunnel that has just been hit is skipped, so nobody surfaces into the fire. So is one still going up or being sold: a tunnel you had only just placed used to count straight away, and units sent across the map queued up at a building site. The computer does it too: a GLA team losing a fight near one of its tunnels falls back underground and comes up at home, which happened 10 to 25 times a match in four Brutal GLA mirrors on Twilight Flame, and an attack wave takes the tunnels when they come up nearer your base than its road does. And the computer now digs them on purpose: a tunnel at home, one at the expansion it holds, and one three quarters of the way down the road its next wave will take, as long as nothing it has seen there can shoot. It does not wait for a fat bank to do it: a tunnel costs 800 and pays back on the first wave. In four Brutal GLA mirrors on Twilight Flame, 10 of 49 attack waves went underground, where none had before, and beaten teams fell back through a tunnel 250 times. Units you put in a tunnel yourself stay put, and a network they have filled is left alone: the order walks. With one place free, everybody still goes through it one after the other, since a unit passing through leaves the moment it arrives. Replays recorded before this change play out differently.+- GLA units take the tunnels on their own. Give a move order across the map, and if the way through your network is any shorter than the walk, the whole selection goes down the tunnel nearest it and comes up at the one nearest where you sent it, then walks the rest. An attack move does the same and comes up still attack-moving, and fresh units heading for a rally point across the map take the tunnels too, fighting on the way if they would have walked there fighting. The tunnels used to have to be almost a third shorter before anybody took them, so fresh units with a tunnel beside their barracks and one beside the rally point mostly walked anyway. Passing through does not count as resting: only units you put inside yourself are healed. The group decides together: fifteen Rebels with six places already taken all go through, where a first version sent ten underground and walked the other five. The green order line shows it: one line to the tunnel they go down and one from the tunnel they come up at to where you sent them. Twelve Rebels crossing a small map with a tunnel at each end got there in 21 seconds instead of 50, four Scorpions in 9 instead of 21. A tunnel that has just been hit is skipped, so nobody surfaces into the fire. So is one still going up or being sold: a tunnel you had only just placed used to count straight away, and units sent across the map queued up at a building site. A tunnel rising again out of a GLA hole counts as going up until it is finished, and units underground when the tunnel they went down is destroyed no longer come up at one. The computer does it too: a GLA team losing a fight near one of its tunnels falls back underground and comes up at home, which happened 10 to 25 times a match in four Brutal GLA mirrors on Twilight Flame, and an attack wave takes the tunnels when they come up nearer your base than its road does. And the computer now digs them on purpose: a tunnel at home, one at the expansion it holds, and one three quarters of the way down the road its next wave will take, as long as nothing it has seen there can shoot. It does not wait for a fat bank to do it: a tunnel costs 800 and pays back on the first wave. In four Brutal GLA mirrors on Twilight Flame, 10 of 49 attack waves went underground, where none had before, and beaten teams fell back through a tunnel 250 times. Units you put in a tunnel yourself stay put, and a network they have filled is left alone: the order walks. With one place free, everybody still goes through it one after the other, since a unit passing through leaves the moment it arrives. Replays recorded before this change play out differently.- Units a move order takes through the tunnels come out still selected. Going underground took each one off your selection and nothing put it back, so a group sent across the map surfaced as nobody's and had to be picked up again by hand. A trip you order by clicking a tunnel still leaves the selection the way it always has, and picking something else while they are underground means they stay out of it.## The power bar tells the truthdiff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cppindex a5df85f70..5466e90c8 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp@@ -208,6 +208,15 @@ Bool TunnelTracker::isInContainer( Object *obj )return (std::find(m_containList.begin(), m_containList.end(), obj) != m_containList.end()) ;}+// ------------------------------------------------------------------------+// A tunnel joins the network the frame its foundation is laid, and one coming back up out of a GLA+// hole is a foundation too, so a ghost nobody has built yet, or one being sold, is on the list; a+// unit sent there walked into the scaffolding.+static Bool isFinishedTunnel( const Object *tunnel )+{+ return !tunnel->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION ) && !tunnel->testStatus( OBJECT_STATUS_SOLD );+}+// ------------------------------------------------------------------------void TunnelTracker::onTunnelCreated( const Object *newTunnel ){@@ -236,11 +245,23 @@ void TunnelTracker::onTunnelDestroyed( const Object *deadTunnel )}else{- // front() on an empty list reads whatever the list's head happens to point at. The loop- // below already copes with a null tunnel, so ask for one only when there is one.- Object *validTunnel = m_tunnelIDs.empty()- ? NULL- : TheGameLogic->findObjectByID( m_tunnelIDs.front() );+ // The mouth named here is the one a trip with nowhere quiet to surface comes out of, so a+ // finished one wins over a foundation or a rebuild out of a hole; with nothing but building+ // sites left, the first of them. The loop below copes with a null tunnel.+ Object *validTunnel = NULL;+ for( std::list<ObjectID>::const_iterator it = m_tunnelIDs.begin(); it != m_tunnelIDs.end(); ++it )+ {+ Object *tunnel = TheGameLogic->findObjectByID( *it );+ if( tunnel == NULL )+ continue;+ if( validTunnel == NULL )+ validTunnel = tunnel;+ if( isFinishedTunnel( tunnel ) )+ {+ validTunnel = tunnel;+ break;+ }+ }// Otherwise, make sure nobody inside remembers the dead tunnel as the one they entered// (scripts need to use so there must be something valid here)for(ContainedItemsList::iterator it = m_containList.begin(); it != m_containList.end(); )@@ -269,9 +290,7 @@ Object *TunnelTracker::findQuietTunnelNear( const Coord3D *pos ) constif( tunnel == NULL || tunnel->isEffectivelyDead() )continue;- // a tunnel joins the network the frame its foundation is laid, so a ghost nobody has built- // yet, or one being sold, is on the list too; a unit sent there walked into the scaffolding- if( tunnel->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION ) || tunnel->testStatus( OBJECT_STATUS_SOLD ) )+ if( !isFinishedTunnel( tunnel ) )continue;// the stamp starts at 0xffffffff, which the sum wraps to just under the window