feat(headless): Implement GhostObjectManagerDummy#2244
Merged
xezon merged 10 commits intoTheSuperHackers:mainfrom Mar 19, 2026
Merged
feat(headless): Implement GhostObjectManagerDummy#2244xezon merged 10 commits intoTheSuperHackers:mainfrom
xezon merged 10 commits intoTheSuperHackers:mainfrom
Conversation
|
| Filename | Overview |
|---|---|
| Generals/Code/GameEngine/Include/GameLogic/GhostObject.h | Adds GhostObjectManagerDummy class with clean no-op overrides for all virtual methods; intentionally skips crc/xfer/loadPostProcess for save compatibility as documented. |
| Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp | Passes TheGlobalData->m_headless to createGhostObjectManager; base factory now returns GhostObjectManagerDummy when headless. Clean and straightforward. |
| Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h | Override updated to accept bool dummy parameter; returns GhostObjectManagerDummy for headless and W3DGhostObjectManager otherwise. The static_cast is a known VC6 requirement (acknowledged in prior review). |
| Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp | Removes W3DDisplay::m_3DScene != nullptr && null guard from addToScene(). Safe in practice now that headless mode uses the dummy manager, but removes defensive protection for W3D edge cases. |
| GeneralsMD/Code/GameEngine/Include/GameLogic/GhostObject.h | Identical GhostObjectManagerDummy addition as in Generals counterpart; correctly mirrors the Generals changes with proper Zero Hour copyright header. |
| GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp | Same null guard removal as the Generals variant — same concern applies regarding losing the defensive check for m_3DScene. |
| GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp | Mirrors the Generals change; createGhostObjectManager(TheGlobalData->m_headless) correctly wires headless detection into the factory. |
| GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h | Identical to Generals counterpart; correctly overrides createGhostObjectManager(bool dummy) and dispatches to GhostObjectManagerDummy or W3DGhostObjectManager. |
| Generals/Code/GameEngine/Include/GameLogic/GameLogic.h | Virtual createGhostObjectManager() signature updated to createGhostObjectManager(bool dummy = false) — default value preserves backward compatibility for any subclasses that don't override it. |
| GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h | Mirrors Generals counterpart; createGhostObjectManager(bool dummy = false) declaration with default parameter is consistent and safe. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["GameLogic::init()"] --> B["createGhostObjectManager(TheGlobalData->m_headless)"]
B --> C{dummy == true?}
C -- "headless mode" --> D["NEW GhostObjectManagerDummy\n(no-op stubs)"]
C -- "normal mode\n(base GameLogic)" --> E["NEW GhostObjectManager"]
C -- "normal mode\n(W3DGameLogic)" --> F["NEW W3DGhostObjectManager\n(full W3D rendering)"]
D --> G["TheGhostObjectManager = dummy\nAll calls are no-ops"]
E --> H["TheGhostObjectManager = base"]
F --> I["TheGhostObjectManager = W3D\nW3DRenderObjectSnapshot::addToScene()\ncalls m_3DScene->Add_Render_Object()"]
Prompt To Fix All With AI
This is a comment left during a code review.
Path: Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp
Line: 154-162
Comment:
**Removed null guard for `m_3DScene`**
The previous check `W3DDisplay::m_3DScene != nullptr &&` guarded against a null pointer dereference on `W3DDisplay::m_3DScene->Add_Render_Object(m_robj)`. With `GhostObjectManagerDummy` now correctly handling headless mode, this path should only be reached when `m_3DScene` is valid — but if `m_3DScene` is ever null in W3D mode (e.g., during startup or teardown edge cases), this will crash instead of failing silently.
The same change exists in `GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp` line 160.
Consider whether the old silent-failure behaviour was masking a real bug, or whether the guard should be preserved as a `DEBUG_ASSERTCRASH` to catch regressions:</p>
```cpp
Bool W3DRenderObjectSnapshot::addToScene()
{
DEBUG_ASSERTCRASH(W3DDisplay::m_3DScene != nullptr, ("W3DRenderObjectSnapshot::addToScene - m_3DScene is null"));
if (!m_robj->Is_In_Scene())
{
W3DDisplay::m_3DScene->Add_Render_Object(m_robj);
return true;
}
return false;
}
```
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: "style(headless): Exp..."
Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h
Outdated
Show resolved
Hide resolved
4d12a95 to
f02b950
Compare
xezon
reviewed
Mar 10, 2026
Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h
Outdated
Show resolved
Hide resolved
…bool arg in GeneralsMD GhostObjectManagerDummy
…bool arg in Generals GhostObjectManagerDummy
xezon
reviewed
Mar 14, 2026
Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h
Outdated
Show resolved
Hide resolved
Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h
Outdated
Show resolved
Hide resolved
Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h
Outdated
Show resolved
Hide resolved
|
has left over comments |
…le dummy in base class in GeneralsMD GhostObjectManagerDummy
…le dummy in base class in Generals GhostObjectManagerDummy
xezon
approved these changes
Mar 19, 2026
GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DGameLogic.h
Outdated
Show resolved
Hide resolved
…alsMD W3DGameLogic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Related
Split from #2139 per @xezon's suggestion to review each dummy class separately.