-
Notifications
You must be signed in to change notification settings - Fork 167
feature(headless): Add ViewDummy for headless mode #2246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7db3410
8509cf8
ed1c2fb
a9f47a3
e439eee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -36,6 +36,7 @@ | |||||
| // SYSTEM INCLUDES //////////////////////////////////////////////////////////// | ||||||
|
|
||||||
| // USER INCLUDES ////////////////////////////////////////////////////////////// | ||||||
| #include "Common/GlobalData.h" | ||||||
| #include "GameClient/InGameUI.h" | ||||||
| #include "GameClient/View.h" | ||||||
| #include "W3DDevice/GameClient/W3DView.h" | ||||||
|
|
@@ -69,7 +70,11 @@ class W3DInGameUI : public InGameUI | |||||
| protected: | ||||||
|
|
||||||
| /// factory for views | ||||||
| virtual View *createView() { return NEW W3DView; } | ||||||
| // TheSuperHackers @fix bobtista 31/01/2026 Return dummy in headless mode | ||||||
| virtual View *createView() | ||||||
| { | ||||||
| return TheGlobalData->m_headless ? static_cast<View*>(NEW ViewDummy) : NEW W3DView; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dereferences
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DInGameUI.h
Line: 76
Comment:
Dereferences `TheGlobalData` without null check; if `createView()` is called before global data initialization, this will crash
```suggestion
return (TheGlobalData && TheGlobalData->m_headless) ? static_cast<View*>(NEW ViewDummy) : NEW W3DView;
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||
| } | ||||||
|
|
||||||
| virtual void drawSelectionRegion(); ///< draw the selection region on screen | ||||||
| virtual void drawMoveHints( View *view ); ///< draw move hint visual feedback | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -36,6 +36,7 @@ | |||||
| // SYSTEM INCLUDES //////////////////////////////////////////////////////////// | ||||||
|
|
||||||
| // USER INCLUDES ////////////////////////////////////////////////////////////// | ||||||
| #include "Common/GlobalData.h" | ||||||
| #include "GameClient/InGameUI.h" | ||||||
| #include "GameClient/View.h" | ||||||
| #include "W3DDevice/GameClient/W3DView.h" | ||||||
|
|
@@ -69,7 +70,11 @@ class W3DInGameUI : public InGameUI | |||||
| protected: | ||||||
|
|
||||||
| /// factory for views | ||||||
| virtual View *createView() { return NEW W3DView; } | ||||||
| // TheSuperHackers @fix bobtista 31/01/2026 Return dummy in headless mode | ||||||
| virtual View *createView() | ||||||
| { | ||||||
| return TheGlobalData->m_headless ? static_cast<View*>(NEW ViewDummy) : NEW W3DView; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dereferences
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DInGameUI.h
Line: 76
Comment:
Dereferences `TheGlobalData` without null check; if `createView()` is called before global data initialization, this will crash
```suggestion
return (TheGlobalData && TheGlobalData->m_headless) ? static_cast<View*>(NEW ViewDummy) : NEW W3DView;
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||
| } | ||||||
|
|
||||||
| virtual void drawSelectionRegion(); ///< draw the selection region on screen | ||||||
| virtual void drawMoveHints( View *view ); ///< draw move hint visual feedback | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several method bodies are on the same line as their signatures, which prevents placing breakpoints on the function body separately from the declaration. Per project conventions, expand these to multi-line format:
Context Used: Rule from
dashboard- Always place if/else/for/while statement bodies on separate lines from the condition to allow precis... (source)Prompt To Fix With AI