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(gameclient): hide units passing through a tunnel from its display
Olcay Seygan517c5e52a20f
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/TunnelTracker.h b/GeneralsMD/Code/GameEngine/Include/Common/TunnelTracker.hindex 8e05f8a77..455a0d589 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/TunnelTracker.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/TunnelTracker.h@@ -70,6 +70,7 @@ public:Object *findQuietTunnelNear( const Coord3D *pos ) const; ///< the tunnel nearest pos that has not been shot at lately, or NULLBool hasTunnelTraveller() const; ///< is anybody inside only passing through, and so about to free their place?+ Int getResidentCount() const; ///< the ones inside to stay: what the network shows, since a traveller is gone the next frameObject *findTunnelShortcut( const Coord3D *from, const Coord3D *to, Real walk ) const; ///< the mouth to go down to get from `from` to `to` quicker than a walk `walk` long, or NULLObject *getCurNemesis(void);diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/TunnelContain.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/TunnelContain.hindex 8934420ff..26b4a25ed 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/TunnelContain.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/TunnelContain.h@@ -121,6 +121,7 @@ public:virtual const ContainedItemsList* getContainedItemsList() const;virtual Bool isContained( const Object *obj ) const;virtual Bool isDisplayedOnControlBar() const { return TRUE; } ///< Does this container display its contents on the ControlBar?+ virtual Bool getContainerPipsToShow( Int& numTotal, Int& numFull ); ///< the ones staying inside; see TunnelTracker::getResidentCountvirtual Bool isKickOutOnCapture(){ return FALSE; }///< Caves and Tunnels don't kick out on capture.// override the onDie we inherit from OpenContaindiff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cppindex 8a97c57a9..73c376503 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp@@ -295,6 +295,19 @@ Bool TunnelTracker::hasTunnelTraveller() constreturn FALSE;}+// ------------------------------------------------------------------------+Int TunnelTracker::getResidentCount() const+{+ Int residents = 0;+ for( ContainedItemsList::const_iterator it = m_containList.begin(); it != m_containList.end(); ++it )+ {+ const AIUpdateInterface *ai = (*it)->getAI();+ if( ai == NULL || !ai->hasTunnelTrip() )+ ++residents;+ }+ return residents;+}+// ------------------------------------------------------------------------static const Real TUNNEL_SHORTCUT_SHARE = 0.7f; ///< the longest a way through the tunnels may be, as a share of the walkdiff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cppindex 79828754e..9ce3b788a 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp@@ -35,6 +35,7 @@#include "Common/Player.h"#include "Common/PlayerList.h"#include "GameLogic/Object.h"+#include "GameLogic/Module/AIUpdate.h"#include "GameLogic/Module/OpenContain.h"#include "GameClient/InGameUI.h"#include "GameClient/Drawable.h"@@ -69,6 +70,12 @@ void ControlBar::populateButtonProc( Object *obj, void *userData ){PopulateButtonInfo* info = (PopulateButtonInfo*)userData;+ // a unit passing through a tunnel on its way somewhere is inside for a frame; a button for it+ // would flash in and out as a group went through+ const AIUpdateInterface *ai = obj->getAI();+ if( ai != NULL && ai->hasTunnelTrip() )+ return;+// sanityDEBUG_ASSERTCRASH( info->buttonIndex < MAX_STRUCTURE_INVENTORY_BUTTONS,("Too many objects inside '%s' for the inventory buttons to hold",diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cppindex ab2edfdda..a39836c49 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp@@ -314,6 +314,15 @@ Int TunnelContain::getContainMax( void ) constreturn tunnelTracker ? tunnelTracker->getContainMax() : 0;}+//-------------------------------------------------------------------------------------------------+Bool TunnelContain::getContainerPipsToShow( Int& numTotal, Int& numFull )+{+ TunnelTracker *tunnelTracker = getTunnelTracker();+ numTotal = getContainMax();+ numFull = tunnelTracker ? tunnelTracker->getResidentCount() : 0;+ return true;+}+const ContainedItemsList* TunnelContain::getContainedItemsList() const{TunnelTracker *tunnelTracker = getTunnelTracker();