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
feat(gameengine): route gla move orders through the tunnel network
Olcay Seygan1c1b7d40f70e
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4a8c34607..bd5d7e9c6 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -398,6 +398,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 every unit whose way through your network is clearly shorter than the walk goes down the nearest tunnel and comes up at the one nearest where you sent it, then walks the rest. 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. 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.## The power bar tells the truthdiff --git a/GeneralsMD/Code/Data/Scenarios/tunnelfull.txt b/GeneralsMD/Code/Data/Scenarios/tunnelfull.txtnew file mode 100644index 000000000..b2aed3b31--- /dev/null+++ b/GeneralsMD/Code/Data/Scenarios/tunnelfull.txt@@ -0,0 +1,19 @@+# Tunnel shortcut with the network full: ten rebels are put in to stay, so the order walks.+#+# The same order as tunnelshortcut.txt; its HEADLESS ARRIVE line should match tunnelwalk.txt's.+#+# generals.exe -headless -quickstart -noshellmap -observer -multiInstance -noFPSLimit+# -randommap 3 2 small -autoskirmish 2 -takeover -side 0 FactionGLA -side 1 FactionAmerica+# -seed 3 -maxframes 4800 -scenario tunnelfull -logPrefix tunnelfull_++30 spawn 0 GLATunnelNetwork 1 start0:0:300+30 spawn 0 GLATunnelNetwork 1 start1:0:300+30 spawn 0 GLAInfantryTunnelDefender 10 start0:0:420 25+60 enter 0 GLAInfantryTunnelDefender 0 GLATunnelNetwork+# the enter picks whichever tunnel it likes, and the last of them is in around frame 2000+2940 spawn 0 GLAInfantryRebel 12 start0:250:300 25+2940 spawn 0 GLATankScorpion 4 start0:-250:300 50+3000 playermove 0 GLAInfantryRebel start1:150:300+3000 playermove 0 GLATankScorpion start1:150:300+3000 arrive 0 GLAInfantryRebel start1:150:300 250+3000 arrive 0 GLATankScorpion start1:150:300 250diff --git a/GeneralsMD/Code/Data/Scenarios/tunnelqueue.txt b/GeneralsMD/Code/Data/Scenarios/tunnelqueue.txtnew file mode 100644index 000000000..81340c80d--- /dev/null+++ b/GeneralsMD/Code/Data/Scenarios/tunnelqueue.txt@@ -0,0 +1,24 @@+# Tunnel shortcut through one free place: nine of the network's ten are taken by units put there to+# stay, and the same order as tunnelshortcut.txt has to pass through the one that is left.+#+# Every member queues at the near mouth and goes through one after the other, since a unit passing+# through leaves by the far mouth the frame after it arrives. Compare with tunnelshortcut.txt+# (ten free places) and tunnelwalk.txt (no tunnels).+#+# generals.exe -headless -quickstart -noshellmap -observer -multiInstance -noFPSLimit+# -randommap 3 2 small -autoskirmish 2 -takeover -side 0 FactionGLA -side 1 FactionAmerica+# -seed 3 -maxframes 4800 -scenario tunnelqueue -logPrefix tunnelqueue_++30 spawn 0 GLATunnelNetwork 1 start0:0:300+30 spawn 0 GLATunnelNetwork 1 start1:0:300+# five here and the two each tunnel comes with make nine+30 spawn 0 GLAInfantryTunnelDefender 5 start0:0:420 25+60 enter 0 GLAInfantryTunnelDefender 0 GLATunnelNetwork++# the enter picks whichever tunnel it likes, and the last of them is in around frame 2000+2940 spawn 0 GLAInfantryRebel 12 start0:250:300 25+2940 spawn 0 GLATankScorpion 4 start0:-250:300 50+3000 playermove 0 GLAInfantryRebel start1:150:300+3000 playermove 0 GLATankScorpion start1:150:300+3000 arrive 0 GLAInfantryRebel start1:150:300 250+3000 arrive 0 GLATankScorpion start1:150:300 250diff --git a/GeneralsMD/Code/Data/Scenarios/tunnelshortcut.txt b/GeneralsMD/Code/Data/Scenarios/tunnelshortcut.txtnew file mode 100644index 000000000..8bc8f34b3--- /dev/null+++ b/GeneralsMD/Code/Data/Scenarios/tunnelshortcut.txt@@ -0,0 +1,19 @@+# Tunnel shortcut: a GLA move order across the map with a tunnel at each end.+#+# A player's move order sends every member whose trip through the network is shorter than the walk+# into the nearest tunnel, and it comes out of the one nearest the goal (AIGroup.cpp,+# pickTunnelEntrance). Compare the HEADLESS ARRIVE line with tunnelwalk.txt, the same order with+# no tunnels, and tunnelfull.txt, where the network is full of units put there to stay.+#+# generals.exe -headless -quickstart -noshellmap -observer -multiInstance -noFPSLimit+# -randommap 3 2 small -autoskirmish 2 -takeover -side 0 FactionGLA -side 1 FactionAmerica+# -seed 3 -maxframes 3000 -scenario tunnelshortcut -logPrefix tunnel_++30 spawn 0 GLATunnelNetwork 1 start0:0:300+30 spawn 0 GLATunnelNetwork 1 start1:0:300+30 spawn 0 GLAInfantryRebel 12 start0:250:300 25+30 spawn 0 GLATankScorpion 4 start0:-250:300 50+90 playermove 0 GLAInfantryRebel start1:150:300+90 playermove 0 GLATankScorpion start1:150:300+90 arrive 0 GLAInfantryRebel start1:150:300 250+90 arrive 0 GLATankScorpion start1:150:300 250diff --git a/GeneralsMD/Code/Data/Scenarios/tunnelwalk.txt b/GeneralsMD/Code/Data/Scenarios/tunnelwalk.txtnew file mode 100644index 000000000..eded5122d--- /dev/null+++ b/GeneralsMD/Code/Data/Scenarios/tunnelwalk.txt@@ -0,0 +1,12 @@+# Tunnel shortcut's baseline: the same order as tunnelshortcut.txt with no tunnels on the map.+#+# generals.exe -headless -quickstart -noshellmap -observer -multiInstance -noFPSLimit+# -randommap 3 2 small -autoskirmish 2 -takeover -side 0 FactionGLA -side 1 FactionAmerica+# -seed 3 -maxframes 3000 -scenario tunnelwalk -logPrefix tunnelwalk_++30 spawn 0 GLAInfantryRebel 12 start0:250:300 25+30 spawn 0 GLATankScorpion 4 start0:-250:300 50+90 playermove 0 GLAInfantryRebel start1:150:300+90 playermove 0 GLATankScorpion start1:150:300+90 arrive 0 GLAInfantryRebel start1:150:300 250+90 arrive 0 GLATankScorpion start1:150:300 250diff --git a/GeneralsMD/Code/GameEngine/Include/Common/TunnelTracker.h b/GeneralsMD/Code/GameEngine/Include/Common/TunnelTracker.hindex a9728a6dd..2583e27b0 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/TunnelTracker.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/TunnelTracker.h@@ -68,6 +68,9 @@ public:const std::list< ObjectID > *getContainerList() const {return &m_tunnelIDs;}+ Object *findQuietTunnelNear( const Coord3D *pos ) const; ///< the tunnel nearest pos that has not been shot at lately, or NULL+ Bool hasTunnelTraveller() const; ///< is anybody inside only passing through, and so about to free their place?+Object *getCurNemesis(void);void updateNemesis(const Object *target);diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.hindex c82768b69..34fe82733 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h@@ -737,6 +737,10 @@ public:// this is intended for use ONLY by the salvage collection pass in GameLogic.void friend_setSalvageReturnPosition( const Coord3D *pos );++ // this is intended for use ONLY by AIGroup's move order, which sends a unit through its tunnel network.+ void friend_setTunnelTrip( const Coord3D *goal );+ Bool hasTunnelTrip() const { return m_hasTunnelTrip; } ///< on its way through the tunnel network to a move order's goal#if defined(_DEBUG) || defined(_INTERNAL)inline const Coord3D *friend_getRequestedDestination() const { return &m_requestedDestination; }inline const Coord3D *friend_getRequestedDestination2() const { return &m_requestedDestination2; }@@ -918,6 +922,8 @@ private:Bool m_hasExitProductionRallyPoint; ///< True while m_exitProductionRallyPoint is still waiting to be ordered.Coord3D m_salvageReturnPosition; ///< Where we stood when we were sent to fetch a salvage crate.Bool m_hasSalvageReturnPosition; ///< True while the walk back to m_salvageReturnPosition is still owed.+ Coord3D m_tunnelTripGoal; ///< Where a move order sent us before a tunnel shortened the way there.+ Bool m_hasTunnelTrip; ///< True from the order to enter a tunnel until the walk from the exit to m_tunnelTripGoal is ordered.// Locomotors -------------------------------------------------------------------------------------------------enum LocoGoalType // Note - written out in save/load xfer, don't change these numbers. jba.diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cppindex 21cba0990..db7104dde 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp@@ -43,6 +43,7 @@#include "GameLogic/Object.h"#include "GameLogic/PartitionManager.h"+#include "GameLogic/Module/AIUpdate.h"#include "GameLogic/Module/BodyModule.h"#include "GameLogic/Module/TunnelContain.h"@@ -252,6 +253,48 @@ void TunnelTracker::onTunnelDestroyed( const Object *deadTunnel )}}+// ------------------------------------------------------------------------+// A mouth that took a hit this recently is not one to send anybody through: they would come out+// into whatever is shooting at it.+static const UnsignedInt TUNNEL_UNDER_FIRE_FRAMES = 2 * LOGICFRAMES_PER_SECOND;++Object *TunnelTracker::findQuietTunnelNear( const Coord3D *pos ) const+{+ const UnsignedInt now = TheGameLogic->getFrame();+ Object *nearest = NULL;+ Real nearestSqr = 0.0f;+ for( std::list<ObjectID>::const_iterator it = m_tunnelIDs.begin(); it != m_tunnelIDs.end(); ++it )+ {+ Object *tunnel = TheGameLogic->findObjectByID( *it );+ if( tunnel == NULL || tunnel->isEffectivelyDead() )+ continue;++ // the stamp starts at 0xffffffff, which the sum wraps to just under the window+ if( tunnel->getBodyModule()->getLastDamageTimestamp() + TUNNEL_UNDER_FIRE_FRAMES > now )+ continue;++ const Real distSqr = ThePartitionManager->getDistanceSquared( tunnel, pos, FROM_CENTER_2D );+ if( nearest == NULL || distSqr < nearestSqr )+ {+ nearest = tunnel;+ nearestSqr = distSqr;+ }+ }+ return nearest;+}++// ------------------------------------------------------------------------+Bool TunnelTracker::hasTunnelTraveller() const+{+ for( ContainedItemsList::const_iterator it = m_containList.begin(); it != m_containList.end(); ++it )+ {+ const AIUpdateInterface *ai = (*it)->getAI();+ if( ai != NULL && ai->hasTunnelTrip() )+ return TRUE;+ }+ return FALSE;+}+// ------------------------------------------------------------------------void TunnelTracker::destroyObject( Object *obj, void * ){diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cppindex 44d36e4db..f366946f2 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp@@ -35,6 +35,7 @@#include "Common/Player.h"#include "Common/SpecialPower.h"#include "Common/ThingTemplate.h"+#include "Common/TunnelTracker.h"#include "Common/Upgrade.h"#include "Common/Xfer.h"#include "Common/XferCRC.h"@@ -57,6 +58,7 @@#include "GameLogic/Module/StealthUpdate.h"#include "GameLogic/Module/SpecialPowerUpdateModule.h"#include "GameLogic/ObjectIter.h"+#include "GameLogic/PartitionManager.h"#include "GameLogic/TerrainLogic.h"#ifdef _INTERNAL@@ -1974,6 +1976,46 @@ static void crowdSeedLanesAlongWaypoint( AIGroup *group, std::list<Object *>& mecrowdSeedLanes( members, center, crowdWaypointAim( center, way ) );}+static const Real TUNNEL_SHORTCUT_SHARE = 0.7f; ///< the longest a way through the tunnels may be, as a share of the walk++/** The tunnel mouth a player's move order sends `unit` into on its way to `dest`, or NULL when it+ walks. A network with no free place is not looked at at all: whatever fills it was put there to+ stay. With one free place the network still carries everybody, one after the other, since a unit+ passing through leaves by the far mouth on the frame after it arrives; what that costs is the+ queue at the near mouth, a body length for every member this order already sent there.++ All three legs are straight lines, like the walk they are measured against.+ ponytail: straight lines, not path lengths; a tunnel across a river the walk has to go round+ looks no better than one across open ground. A path search per member when that matters. */+static Object *pickTunnelEntrance( Object *unit, const Coord3D *dest, std::vector<ObjectID> &sentThrough )+{+ if (!unit->getAIUpdateInterface()->isDoingGroundMovement())+ return NULL;++ const TunnelTracker *network = unit->getControllingPlayer()->getTunnelSystem();+ if ((Int)network->getContainCount() >= network->getContainMax())+ return NULL;++ Object *entrance = network->findQuietTunnelNear( unit->getPosition() );+ Object *exit = network->findQuietTunnelNear( dest );+ if (entrance == NULL || exit == entrance)+ return NULL;++ if (!TheActionManager->canEnterObject( unit, entrance, CMD_FROM_PLAYER, DONT_CHECK_CAPACITY ))+ return NULL;++ const Int queued = (Int)std::count( sentThrough.begin(), sentThrough.end(), entrance->getID() );+ const Real queue = queued * 2.0f * unit->getGeometryInfo().getBoundingCircleRadius();+ const Real toEntrance = (Real)sqrt( ThePartitionManager->getDistanceSquared( unit, entrance, FROM_CENTER_2D ) );+ const Real fromExit = (Real)sqrt( ThePartitionManager->getDistanceSquared( exit, dest, FROM_CENTER_2D ) );+ const Real walk = (Real)sqrt( ThePartitionManager->getDistanceSquared( unit, dest, FROM_CENTER_2D ) );+ if (toEntrance + queue + fromExit > walk * TUNNEL_SHORTCUT_SHARE)+ return NULL;++ sentThrough.push_back( entrance->getID() );+ return entrance;+}+/*** Move to given position(s)*/@@ -2361,6 +2403,7 @@ void AIGroup::groupMoveToPosition( const Coord3D *p_posIn, Bool addWaypoint, Com}Int floodCursor = 0;Int airCursor = 0;+ std::vector<ObjectID> sentThroughTunnels;// Works better if you let the near units get the first paths... jba.// Move the ones nearest the goal first. Reduces collision problems later.@@ -2390,6 +2433,16 @@ void AIGroup::groupMoveToPosition( const Coord3D *p_posIn, Bool addWaypoint, Comelse if (airCursor < (Int)airMembers.size() && airMembers[airCursor] == theUnit)dest = airGoals[airCursor++];+ // through the tunnel network when that is shorter; see pickTunnelEntrance+ Object *entrance = pickTunnelEntrance( theUnit, &dest, sentThroughTunnels );+ if (entrance != NULL)+ {+ ai->clearCrowdLane();+ ai->aiEnter( entrance, cmdSource );+ ai->friend_setTunnelTrip( &dest );+ continue;+ }+// a vehicle drives its lane of the group's route; a foot soldier walks through the crowdif (!trunkRoute.empty() && !theUnit->isKindOf( KINDOF_INFANTRY ) && ai->isDoingGroundMovement()){diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cppindex d2eed066f..58167f612 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp@@ -41,6 +41,7 @@#include "Common/Team.h"#include "Common/ThingTemplate.h"#include "Common/ThingFactory.h"+#include "Common/TunnelTracker.h"#include "Common/Xfer.h"#include "Common/XFerCRC.h"@@ -6877,6 +6878,14 @@ void AIEnterState::loadPostProcess( void )AIInternalMoveToState::loadPostProcess();} // end loadPostProcess+//----------------------------------------------------------------------------------------------------------+/** A unit passing through a tunnel on its way somewhere queues at a full mouth instead of giving up+ on it; see AIEnterState::update. */+static CanEnterType enterCapacityCheck( const Object *obj )+{+ return obj->getAI()->hasTunnelTrip() ? DONT_CHECK_CAPACITY : CHECK_CAPACITY;+}+//----------------------------------------------------------------------------------------------------------StateReturnType AIEnterState::onEnter(){@@ -6886,8 +6895,8 @@ StateReturnType AIEnterState::onEnter()Object* goal = getMachineGoalObject();if (goal){- if( !TheActionManager->canEnterObject( obj, goal, obj->getAI()->getLastCommandSource(), CHECK_CAPACITY ) )- return STATE_FAILURE;+ if( !TheActionManager->canEnterObject( obj, goal, obj->getAI()->getLastCommandSource(), enterCapacityCheck( obj ) ) )+ return STATE_FAILURE;m_goalPosition = *goal->getPosition();@@ -6980,7 +6989,7 @@ StateReturnType AIEnterState::update()m_goalPosition = *goal->getPosition();obj->getAI()->friend_setGoalObject(goal);- if (!TheActionManager->canEnterObject(obj, goal, obj->getAI()->getLastCommandSource(), CHECK_CAPACITY))+ if (!TheActionManager->canEnterObject(obj, goal, obj->getAI()->getLastCommandSource(), enterCapacityCheck( obj ))){/*special-case: if it's an enemy, try attacking it instead. this is to address this bug: (srj)@@ -7029,7 +7038,15 @@ StateReturnType AIEnterState::update()code = STATE_CONTINUE;}- if (code == STATE_SUCCESS)+ // Passing through a full tunnel network means waiting at the mouth for a place, as long as+ // somebody inside is passing through too and will free one. Everybody inside having been put+ // there to stay means no place is coming, and the trip walks instead.+ if (code == STATE_SUCCESS && obj->getAI()->hasTunnelTrip() && !goal->getContain()->isValidContainerFor( obj, TRUE ))+ {+ return goal->getControllingPlayer()->getTunnelSystem()->hasTunnelTraveller() ? STATE_CONTINUE : STATE_FAILURE;+ }++ if (code == STATE_SUCCESS){// Make sure we entered the container.// srj sez: I don't think we want to restrict this to HELD items. See the intro of GLA02.mapdiff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cppindex 5bcbe4bc9..dabb3ba79 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp@@ -42,6 +42,7 @@#include "Common/Team.h"#include "Common/ThingFactory.h"#include "Common/ThingTemplate.h"+#include "Common/TunnelTracker.h"#include "Common/Upgrade.h"#include "Common/PerfTimer.h"#include "Common/UnitTimings.h"@@ -353,6 +354,8 @@ AIUpdateInterface::AIUpdateInterface( Thing *thing, const ModuleData* moduleDatam_hasExitProductionRallyPoint = FALSE;m_salvageReturnPosition.zero();m_hasSalvageReturnPosition = FALSE;+ m_tunnelTripGoal.zero();+ m_hasTunnelTrip = FALSE;m_locomotorSet.clear();m_curLocomotor = NULL;m_curLocomotorSet = LOCOMOTORSET_INVALID;@@ -1202,6 +1205,27 @@ UpdateSleepTime AIUpdateInterface::update( void )stRet = STATE_CONTINUE;}+ // A move order that a tunnel shortened: idle inside the network means the enter just finished, so+ // leave by the mouth nearest the goal; idle outside means the exit is done, or the enter gave up,+ // and either way what is left is the walk to the goal.+ if (m_hasTunnelTrip && getAIStateType() == AI_IDLE)+ {+ Object *me = getObject();+ Object *tunnel = me->getContainedBy();+ if (tunnel != NULL && tunnel->getContain()->isTunnelContain())+ {+ Object *exit = me->getControllingPlayer()->getTunnelSystem()->findQuietTunnelNear( &m_tunnelTripGoal );+ privateExit( exit != NULL ? exit : tunnel, CMD_FROM_AI );+ }+ else+ {+ Coord3D goal = m_tunnelTripGoal;+ m_hasTunnelTrip = FALSE;+ privateMoveToPosition( &goal, CMD_FROM_AI );+ }+ stRet = STATE_CONTINUE;+ }+if (IS_STATE_SLEEP(stRet)){Int frames = GET_STATE_SLEEP_FRAMES(stRet);@@ -4393,6 +4417,11 @@ void AIUpdateInterface::aiDoCommand(const AICommandParms* parms)// first and the return position recorded after, so this does not eat its own trip.m_hasSalvageReturnPosition = FALSE;+ // A tunnel trip drives itself with AI orders - the exit, the step out of the door - so only an+ // order from somebody else ends it.+ if (parms->m_cmdSource != CMD_FROM_AI)+ m_hasTunnelTrip = FALSE;+#ifdef ALLOW_SURRENDER// surrendered items have very limited options, and only via AI cmdsif (isSurrendered())@@ -5178,6 +5207,17 @@ void AIUpdateInterface::friend_setSalvageReturnPosition( const Coord3D *pos )m_hasSalvageReturnPosition = TRUE;}+//----------------------------------------------------------------------------------------+/**+ * Remember the goal of the move order that was just turned into an enter into a tunnel. update()+ * takes it from there: out of the mouth nearest the goal, then the walk to it.+ */+void AIUpdateInterface::friend_setTunnelTrip( const Coord3D *goal )+{+ m_tunnelTripGoal = *goal;+ m_hasTunnelTrip = TRUE;+}+//----------------------------------------------------------------------------------------/*** Follow the path defined by the given array of points@@ -7018,12 +7058,13 @@ void AIUpdateInterface::crc( Xfer *x )* 11: m_isMoving, which the duplicated m_isSafePath used to stand in place of* 12: m_allowedToChase* 13: m_pathfindFoundNothing- * 14: the salvage return position and its flag */+ * 14: the salvage return position and its flag+ * 16: the tunnel trip's goal and its flag */// ------------------------------------------------------------------------------------------------void AIUpdateInterface::xfer( Xfer *xfer ){// version- const XferVersion currentVersion = 15;+ const XferVersion currentVersion = 16;XferVersion version = currentVersion;xfer->xferVersion( &version, currentVersion );@@ -7341,6 +7382,13 @@ void AIUpdateInterface::xfer( Xfer *xfer )}}+ if (version >= 16)+ {+ // a save made between a tunnel's enter and the walk out of the far mouth owes the rest of the trip+ xfer->xferCoord3D(&m_tunnelTripGoal);+ xfer->xferBool(&m_hasTunnelTrip);+ }+} // end xfer// ------------------------------------------------------------------------------------------------