diff --git a/Generals/Code/GameEngine/Include/GameLogic/GhostObject.h b/Generals/Code/GameEngine/Include/GameLogic/GhostObject.h index 17ea737e919..f8e96e37b03 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/GhostObject.h +++ b/Generals/Code/GameEngine/Include/GameLogic/GhostObject.h @@ -108,5 +108,19 @@ inline Bool GhostObjectManager::trackAllPlayers() const #endif } +// TheSuperHackers @feature bobtista 19/01/2026 +// GhostObjectManager that does nothing for headless mode. +// Note: Does NOT override crc/xfer/loadPostProcess to maintain save compatibility. +class GhostObjectManagerDummy : public GhostObjectManager +{ +public: + virtual void reset(void) {} + virtual GhostObject *addGhostObject(Object *object, PartitionData *pd) { return nullptr; } + virtual void removeGhostObject(GhostObject *mod) {} + virtual void updateOrphanedObjects(int *playerIndexList, int playerIndexCount) {} + virtual void releasePartitionData(void) {} + virtual void restorePartitionData(void) {} +}; + // the singleton extern GhostObjectManager *TheGhostObjectManager; diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h index 24c774d8e76..2a92a46d637 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h @@ -36,6 +36,7 @@ // SYSTEM INCLUDES //////////////////////////////////////////////////////////// // USER INCLUDES ////////////////////////////////////////////////////////////// +#include "Common/GlobalData.h" #include "GameLogic/GameLogic.h" #include "W3DDevice/GameLogic/W3DTerrainLogic.h" #include "W3DDevice/GameLogic/W3DGhostObject.h" @@ -59,6 +60,7 @@ class W3DGameLogic : public GameLogic /// factory for TheTerrainLogic, called from init() virtual TerrainLogic *createTerrainLogic( void ) { return NEW W3DTerrainLogic; }; - virtual GhostObjectManager *createGhostObjectManager(void) { return NEW W3DGhostObjectManager; } + // TheSuperHackers @feature bobtista 19/01/2026 Use dummy for headless mode + virtual GhostObjectManager *createGhostObjectManager(void) { return TheGlobalData->m_headless ? static_cast(NEW GhostObjectManagerDummy) : NEW W3DGhostObjectManager; } }; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index fa46b30411f..e284cbbd59c 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -153,7 +153,7 @@ void W3DRenderObjectSnapshot::update(RenderObjClass *robj, DrawableInfo *drawInf // ------------------------------------------------------------------------------------------------ Bool W3DRenderObjectSnapshot::addToScene(void) { - if (W3DDisplay::m_3DScene != nullptr && !m_robj->Is_In_Scene()) + if (!m_robj->Is_In_Scene()) { W3DDisplay::m_3DScene->Add_Render_Object(m_robj); return true; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h index 7f2dbf14365..4307f3b0162 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h @@ -108,5 +108,19 @@ inline Bool GhostObjectManager::trackAllPlayers() const #endif } +// TheSuperHackers @feature bobtista 19/01/2026 +// GhostObjectManager that does nothing for headless mode. +// Note: Does NOT override crc/xfer/loadPostProcess to maintain save compatibility. +class GhostObjectManagerDummy : public GhostObjectManager +{ +public: + virtual void reset(void) {} + virtual GhostObject *addGhostObject(Object *object, PartitionData *pd) { return nullptr; } + virtual void removeGhostObject(GhostObject *mod) {} + virtual void updateOrphanedObjects(int *playerIndexList, int playerIndexCount) {} + virtual void releasePartitionData(void) {} + virtual void restorePartitionData(void) {} +}; + // the singleton extern GhostObjectManager *TheGhostObjectManager; diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h index c6bb4f4c7f8..521d3bdb30b 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h @@ -36,6 +36,7 @@ // SYSTEM INCLUDES //////////////////////////////////////////////////////////// // USER INCLUDES ////////////////////////////////////////////////////////////// +#include "Common/GlobalData.h" #include "GameLogic/GameLogic.h" #include "W3DDevice/GameLogic/W3DTerrainLogic.h" #include "W3DDevice/GameLogic/W3DGhostObject.h" @@ -59,6 +60,7 @@ class W3DGameLogic : public GameLogic /// factory for TheTerrainLogic, called from init() virtual TerrainLogic *createTerrainLogic( void ) { return NEW W3DTerrainLogic; }; - virtual GhostObjectManager *createGhostObjectManager(void) { return NEW W3DGhostObjectManager; } + // TheSuperHackers @feature bobtista 19/01/2026 Use dummy for headless mode + virtual GhostObjectManager *createGhostObjectManager(void) { return TheGlobalData->m_headless ? static_cast(NEW GhostObjectManagerDummy) : NEW W3DGhostObjectManager; } }; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index 4e8a78c5498..25bec35c9a9 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -157,7 +157,7 @@ void W3DRenderObjectSnapshot::update(RenderObjClass *robj, DrawableInfo *drawInf // ------------------------------------------------------------------------------------------------ Bool W3DRenderObjectSnapshot::addToScene(void) { - if (W3DDisplay::m_3DScene != nullptr && !m_robj->Is_In_Scene()) + if (!m_robj->Is_In_Scene()) { W3DDisplay::m_3DScene->Add_Render_Object(m_robj); return true;