From 393f23b8bd16c89b2a269bde1f62336a1fedb75e Mon Sep 17 00:00:00 2001 From: bobtista Date: Mon, 19 Jan 2026 01:22:23 -0600 Subject: [PATCH 1/2] feat(headless): Add GhostObjectManagerDummy for headless mode --- .../GameEngine/Include/GameLogic/GhostObject.h | 14 ++++++++++++++ .../Include/W3DDevice/GameLogic/W3DGameLogic.h | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h index 7f2dbf14365..b03bd8abcf6 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 NULL; } + 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..8d23db63a35 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h @@ -39,6 +39,7 @@ #include "GameLogic/GameLogic.h" #include "W3DDevice/GameLogic/W3DTerrainLogic.h" #include "W3DDevice/GameLogic/W3DGhostObject.h" +#include "Common/GlobalData.h" class W3DGhostObjectManager; /////////////////////////////////////////////////////////////////////////////// @@ -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; } }; From fce30a5ac99112f0d2d14b862d921018bc61fb07 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Mon, 19 Jan 2026 12:25:45 -0600 Subject: [PATCH 2/2] style(headless): Use nullptr instead of NULL in GhostObjectManagerDummy --- GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h index b03bd8abcf6..4307f3b0162 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h @@ -115,7 +115,7 @@ class GhostObjectManagerDummy : public GhostObjectManager { public: virtual void reset(void) {} - virtual GhostObject *addGhostObject(Object *object, PartitionData *pd) { return NULL; } + 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) {}