feature(headless): Add GhostObjectManagerDummy for headless mode#2244
feature(headless): Add GhostObjectManagerDummy for headless mode#2244bobtista wants to merge 4 commits intoTheSuperHackers:mainfrom
Conversation
Greptile Overview
|
| Filename | Overview |
|---|---|
| Generals/Code/GameEngine/Include/GameLogic/GhostObject.h | Added GhostObjectManagerDummy class with no-op implementations for headless mode |
| Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h | Modified factory to return GhostObjectManagerDummy when m_headless is true |
| Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp | Removed m_3DScene null check in addToScene(), now redundant with dummy implementation |
| GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h | Added GhostObjectManagerDummy class with no-op implementations for headless mode |
| GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h | Modified factory to return GhostObjectManagerDummy when m_headless is true |
| GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp | Removed m_3DScene null check in addToScene(), now redundant with dummy implementation |
Sequence Diagram
sequenceDiagram
participant W3DGameLogic
participant GhostObjectManagerDummy
participant PartitionManager
participant W3DGhostObject
Note over W3DGameLogic: createGhostObjectManager()
alt headless mode
W3DGameLogic->>GhostObjectManagerDummy: NEW GhostObjectManagerDummy
GhostObjectManagerDummy-->>W3DGameLogic: return dummy instance
else normal mode
W3DGameLogic->>W3DGhostObject: NEW W3DGhostObjectManager
W3DGhostObject-->>W3DGameLogic: return real instance
end
Note over PartitionManager: Object enters fog
alt headless mode with dummy
PartitionManager->>GhostObjectManagerDummy: addGhostObject(object, pd)
GhostObjectManagerDummy-->>PartitionManager: return nullptr (no-op)
Note over PartitionManager: No ghost object created<br/>No scene interaction needed
else normal mode
PartitionManager->>W3DGhostObject: addGhostObject(object, pd)
W3DGhostObject->>W3DGhostObject: Create W3DGhostObject
W3DGhostObject->>W3DGhostObject: addToScene() - adds to m_3DScene
W3DGhostObject-->>PartitionManager: return ghost object
end
| 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; } |
There was a problem hiding this comment.
Unnecessary static_cast<GhostObjectManager*> since GhostObjectManagerDummy already inherits from GhostObjectManager
| 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.| 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; } |
There was a problem hiding this comment.
Unnecessary static_cast<GhostObjectManager*> since GhostObjectManagerDummy already inherits from GhostObjectManager
| 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.There was a problem hiding this comment.
I think this is required for VC6, it failed to build without it
Summary
Related
Split from #2139 per @xezon's suggestion to review each dummy class separately.