unify(controlbar): Merge and move ControlBar and related code to core#2849
unify(controlbar): Merge and move ControlBar and related code to core#2849stephanmeesters wants to merge 2 commits into
Conversation
95571e0 to
da28ca7
Compare
|
| Filename | Overview |
|---|---|
| Core/GameEngine/CMakeLists.txt | Uncomments 15 ControlBar source/header entries in GAMEENGINE_SRC. Aligns correctly with the complementary removals in Generals and GeneralsMD CMakeLists files. |
| Core/GameEngineDevice/CMakeLists.txt | Uncomments W3DControlBar.cpp in the Core device layer, mirroring the removal from Generals and GeneralsMD device CMakeLists files. |
| Generals/Code/GameEngine/CMakeLists.txt | Comments out the 15 Generals-specific ControlBar entries from GAMEENGINE_SRC so that the Core versions are used instead. |
| GeneralsMD/Code/GameEngine/CMakeLists.txt | Comments out the 15 Zero Hour-specific ControlBar entries from GAMEENGINE_SRC to switch to the shared Core version. |
| Core/GameEngine/Include/GameClient/ControlBar.h | Moved from Generals/. Uses #pragma once correctly. Contains duplicate forward declarations for WindowVideoManager and GameWindow that are harmless but should be cleaned up. |
| Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp | Main ControlBar implementation moved to Core. Contains unified Generals/Zero Hour shortcut bar handling. Inner scope re-declaration of loop variable i inside populateSpecialPowerShortcut is a pre-existing minor shadow issue. |
| Core/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp | Tooltip description logic moved to Core. Implements new features: free-item cost hiding, building-specific max-count text, and promotion listing in upgrade tooltips. Logic looks correct. |
| scripts/cpp/unify_move_files.py | Marks previously active CommandXlat and related unify_file calls as done (commented out), and documents the completed ControlBar move as also done. No functional script logic changed. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph Core ["Core (shared)"]
CE["Core/GameEngine/CMakeLists.txt\n(ControlBar sources NOW enabled)"]
CED["Core/GameEngineDevice/CMakeLists.txt\n(W3DControlBar.cpp NOW enabled)"]
CB["Core/.../ControlBar.cpp\nControlBar.h, ControlBarScheme, etc."]
W3D["Core/.../W3DControlBar.cpp"]
end
subgraph Generals ["Generals (game-specific)"]
GE["Generals/Code/GameEngine/CMakeLists.txt\n(ControlBar entries commented out)"]
GDEL["Generals ControlBar source files\n(DELETED)"]
end
subgraph GeneralsMD ["GeneralsMD / Zero Hour (game-specific)"]
ZE["GeneralsMD/Code/GameEngine/CMakeLists.txt\n(ControlBar entries commented out)"]
end
CE -->|"INTERFACE sources via corei_gameengine_private"| g_gameengine["g_gameengine (Generals build)"]
CE -->|"INTERFACE sources via corei_gameengine_private"| z_gameengine["z_gameengine (Zero Hour build)"]
CED -->|"INTERFACE sources"| g_gameengine
CED -->|"INTERFACE sources"| z_gameengine
GE -->|"game-specific files"| g_gameengine
ZE -->|"game-specific files"| z_gameengine
CB -.->|"compiled into"| CE
W3D -.->|"compiled into"| CED
GDEL -.-|"replaced by Core"| CB
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
subgraph Core ["Core (shared)"]
CE["Core/GameEngine/CMakeLists.txt\n(ControlBar sources NOW enabled)"]
CED["Core/GameEngineDevice/CMakeLists.txt\n(W3DControlBar.cpp NOW enabled)"]
CB["Core/.../ControlBar.cpp\nControlBar.h, ControlBarScheme, etc."]
W3D["Core/.../W3DControlBar.cpp"]
end
subgraph Generals ["Generals (game-specific)"]
GE["Generals/Code/GameEngine/CMakeLists.txt\n(ControlBar entries commented out)"]
GDEL["Generals ControlBar source files\n(DELETED)"]
end
subgraph GeneralsMD ["GeneralsMD / Zero Hour (game-specific)"]
ZE["GeneralsMD/Code/GameEngine/CMakeLists.txt\n(ControlBar entries commented out)"]
end
CE -->|"INTERFACE sources via corei_gameengine_private"| g_gameengine["g_gameengine (Generals build)"]
CE -->|"INTERFACE sources via corei_gameengine_private"| z_gameengine["z_gameengine (Zero Hour build)"]
CED -->|"INTERFACE sources"| g_gameengine
CED -->|"INTERFACE sources"| z_gameengine
GE -->|"game-specific files"| g_gameengine
ZE -->|"game-specific files"| z_gameengine
CB -.->|"compiled into"| CE
W3D -.->|"compiled into"| CED
GDEL -.-|"replaced by Core"| CB
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
Core/GameEngine/Include/GameClient/ControlBar.h:41-50
**Duplicate forward declarations**
`class WindowVideoManager;` is declared on both line 47 and line 48, and `class GameWindow;` is declared on both line 41 and line 50. These are harmless in C++ but are clear copy-paste artifacts that may generate compiler warnings and add noise to the header. Since this file is now actively compiled for both games, it is a good time to clean them up.
Reviews (1): Last reviewed commit: "unify(controlbar): Move ControlBar files..." | Re-trigger Greptile
xezon
left a comment
There was a problem hiding this comment.
Fixed a Base Generals HUD regression where the Generals Powers shortcut bar could disappear
How did Generals regress?
| descrip.concat( TheGameText->fetch( "TOOLTIP:TooltipCannotBuildUnitBecauseMaximumNumber" ) ); | ||
| if ( thingTemplate->isKindOf( KINDOF_STRUCTURE ) ) | ||
| { | ||
| descrip.concat( TheGameText->fetch( "TOOLTIP:TooltipCannotBuildBuildingBecauseMaximumNumber" ) ); |
There was a problem hiding this comment.
This tool tip string does not exist in Generals and therefore will show placeholder text now.
| win = TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "GeneralsExpPoints.wnd:GenExpParent" ) ); | ||
| if(win) | ||
| { | ||
| win->winSetEnabledImage(0,m_powerPurchaseImage); |
There was a problem hiding this comment.
m_powerPurchaseImage will be null here in Generals. Is this ok?
Merge by rebase
Rebased and diffs checked in WinMerge. Re-applied the move with the script.
Changes to Generals
Todo