Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Generals/Code/GameEngine/Include/GameLogic/GhostObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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<GhostObjectManager*>(NEW GhostObjectManagerDummy) : NEW W3DGhostObjectManager; }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary static_cast<GhostObjectManager*> since GhostObjectManagerDummy already inherits from GhostObjectManager

Suggested change
virtual GhostObjectManager *createGhostObjectManager(void) { return TheGlobalData->m_headless ? static_cast<GhostObjectManager*>(NEW GhostObjectManagerDummy) : NEW W3DGhostObjectManager; }
virtual GhostObjectManager *createGhostObjectManager(void) { return TheGlobalData->m_headless ? NEW GhostObjectManagerDummy : NEW W3DGhostObjectManager; }
Prompt To Fix With AI
This is a comment left during a code review.
Path: Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h
Line: 64:64

Comment:
Unnecessary `static_cast<GhostObjectManager*>` since `GhostObjectManagerDummy` already inherits from `GhostObjectManager`

```suggestion
	virtual GhostObjectManager *createGhostObjectManager(void) { return TheGlobalData->m_headless ? NEW GhostObjectManagerDummy : NEW W3DGhostObjectManager; }
```

How can I resolve this? If you propose a fix, please make it concise.


};
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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<GhostObjectManager*>(NEW GhostObjectManagerDummy) : NEW W3DGhostObjectManager; }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary static_cast<GhostObjectManager*> since GhostObjectManagerDummy already inherits from GhostObjectManager

Suggested change
virtual GhostObjectManager *createGhostObjectManager(void) { return TheGlobalData->m_headless ? static_cast<GhostObjectManager*>(NEW GhostObjectManagerDummy) : NEW W3DGhostObjectManager; }
virtual GhostObjectManager *createGhostObjectManager(void) { return TheGlobalData->m_headless ? NEW GhostObjectManagerDummy : NEW W3DGhostObjectManager; }
Prompt To Fix With AI
This is a comment left during a code review.
Path: GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h
Line: 64:64

Comment:
Unnecessary `static_cast<GhostObjectManager*>` since `GhostObjectManagerDummy` already inherits from `GhostObjectManager`

```suggestion
	virtual GhostObjectManager *createGhostObjectManager(void) { return TheGlobalData->m_headless ? NEW GhostObjectManagerDummy : NEW W3DGhostObjectManager; }
```

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is required for VC6, it failed to build without it


};
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading