Skip to content

unify(controlbar): Merge and move ControlBar and related code to core#2849

Open
stephanmeesters wants to merge 2 commits into
TheSuperHackers:mainfrom
stephanmeesters:unify/merge-move-controlbar
Open

unify(controlbar): Merge and move ControlBar and related code to core#2849
stephanmeesters wants to merge 2 commits into
TheSuperHackers:mainfrom
stephanmeesters:unify/merge-move-controlbar

Conversation

@stephanmeesters

@stephanmeesters stephanmeesters commented Jul 1, 2026

Copy link
Copy Markdown

Merge by rebase

Rebased and diffs checked in WinMerge. Re-applied the move with the script.

Changes to Generals

  • Added support for dynamic General's Power purchase images.
    • This is for a custom background image of the General's Power screen, used to get a general-specific background image in ZH. Not used in Generals
    • Now resizes the panel based on the size of that background image (if it exists)
  • Unified special-power shortcut handling enum (FROM_COMMAND_CENTER to FROM_SHORTCUT)
    • No runtime change
  • Let OCL timer tech buildings show rally-point controls when supported.
    • Not used in Generals, this is used for the TechReinforcementPad in ZH
  • Hid tooltip cost text for free items and science
    • Not used in Generals, a zero-cost UI item is for example switching fake/real buildings in ZH.
  • Showed building-specific max-count tooltip text.
    • Reverted to using the unit max-count text using an #ifdef
  • Adds support for a prerequisite science for a command button
    • Appears to be used for MOAB in ZH

Todo

  • Add pull id's
  • Test

@stephanmeesters stephanmeesters force-pushed the unify/merge-move-controlbar branch from 95571e0 to da28ca7 Compare July 1, 2026 11:50
@greptile-apps

greptile-apps Bot commented Jul 1, 2026

Copy link
Copy Markdown

Greptile Summary

This PR unifies the ControlBar subsystem by moving all related source files from GeneralsMD/Code/ to Core/, deleting the now-redundant Generals/Code/ copies, and updating CMakeLists.txt across all three game targets. A handful of functional additions accompany the merge in ControlBarPopupDescription.cpp, backported from the ZH version.

  • File unification: All ControlBar headers, .cpp files, and W3DControlBar.cpp are renamed from GeneralsMD/Code/Core/ at 100% git similarity; the corresponding Generals/Code/ copies are deleted and all CMakeLists.txt files are updated to point at the new Core location.
  • ControlBarPopupDescription.cpp changes: The cost field is now hidden (not just cleared) when costToBuild == 0 (free items/sciences); a prerequisite-science check (missingScience) is added for upgrade buttons; and the max-count tooltip falls back from a building-specific string (TooltipCannotBuildBuildingBecauseMaximumNumber) to the unit string when the former is absent from the string table.
  • Script maintenance: scripts/cpp/unify_move_files.py marks all previously-active unify_file steps (CommandXlat, ControlBar, etc.) as completed (commented out), consistent with the files now existing in Core.

Confidence Score: 5/5

Safe to merge — this is a well-structured file unification with no functional regressions for the Generals build and clearly-scoped ZH additions.

All ControlBar files are moved from GeneralsMD/ to Core/ at 100% git similarity, with the Generals/ copies deleted. The only modified file is ControlBarPopupDescription.cpp, whose 23-line delta adds cost-field hiding, prerequisite-science messaging, and a building max-count tooltip fallback — all guarded and backward-compatible with Generals. CMakeLists.txt changes are symmetric across all three targets, and the unify script correctly reflects the completed steps.

No files require special attention. The CMakeLists.txt changes across Core, Generals, and GeneralsMD are straightforward and consistent.

Important Files Changed

Filename Overview
Core/GameEngine/CMakeLists.txt Uncomments all ControlBar source and header entries, enabling them in the Core build. Changes mirror what was removed from Generals/GeneralsMD CMakeLists.txt — looks correct.
Core/GameEngineDevice/CMakeLists.txt Uncomments W3DControlBar.cpp for the Core device build, consistent with the engine CMake changes.
Generals/Code/GameEngine/CMakeLists.txt Comments out all ControlBar entries (headers and sources) now served from Core. Change is symmetric with Core/CMakeLists.txt additions.
GeneralsMD/Code/GameEngine/CMakeLists.txt Comments out all ControlBar entries for ZH, consistent with the files having been renamed to Core/.
GeneralsMD/Code/GameEngineDevice/CMakeLists.txt Comments out W3DControlBar.cpp for ZH device build; now served from Core/GameEngineDevice.
Generals/Code/GameEngineDevice/CMakeLists.txt Comments out W3DControlBar.cpp for Generals device build; now served from Core/GameEngineDevice.
Core/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp New Core file (moved from GeneralsMD, 100% similarity except for 23 changed lines). Adds cost-field hiding for zero-cost items, prerequisite-science messaging for upgrades (MOAB), and a building-specific max-count tooltip with a Generals fallback. Logic is clean and consistent with existing patterns.
scripts/cpp/unify_move_files.py Marks all previously-active unify steps (CommandXlat and related, plus new ControlBar entries) as completed by commenting them out. All referenced files already exist in Core/, so the comments are correct.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph Before["Before this PR"]
        GEN["Generals/Code/GameEngine/\nControlBar headers + sources"]
        ZH["GeneralsMD/Code/GameEngine/\nControlBar headers + sources"]
        CORE_EMPTY["Core/GameEngine/\nControlBar (commented out in CMake)"]
    end

    subgraph After["After this PR"]
        CORE["Core/GameEngine/\nControlBar headers + sources\n(active in CMake)"]
        GEN_DEL["Generals/ ControlBar files\nDELETED"]
    end

    subgraph CMake["CMakeLists.txt changes"]
        CORE_CMAKE["Core CMakeLists:\nUncommented ControlBar entries"]
        GEN_CMAKE["Generals CMakeLists:\nCommented out ControlBar entries"]
        ZH_CMAKE["GeneralsMD CMakeLists:\nCommented out ControlBar entries"]
    end

    ZH -->|"git rename R100"| CORE
    GEN -->|"deleted"| GEN_DEL
    CORE_EMPTY -->|"replaced"| CORE

    CORE --> CORE_CMAKE
    GEN_DEL --> GEN_CMAKE
    CORE --> ZH_CMAKE

    subgraph PopupDiff["ControlBarPopupDescription.cpp additions"]
        P1["+ Hide cost widget when costToBuild == 0"]
        P2["+ missingScience check for upgrade prerequisites"]
        P3["+ Building-specific max-count tooltip with fallback"]
    end

    CORE --> PopupDiff
Loading
%%{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 Before["Before this PR"]
        GEN["Generals/Code/GameEngine/\nControlBar headers + sources"]
        ZH["GeneralsMD/Code/GameEngine/\nControlBar headers + sources"]
        CORE_EMPTY["Core/GameEngine/\nControlBar (commented out in CMake)"]
    end

    subgraph After["After this PR"]
        CORE["Core/GameEngine/\nControlBar headers + sources\n(active in CMake)"]
        GEN_DEL["Generals/ ControlBar files\nDELETED"]
    end

    subgraph CMake["CMakeLists.txt changes"]
        CORE_CMAKE["Core CMakeLists:\nUncommented ControlBar entries"]
        GEN_CMAKE["Generals CMakeLists:\nCommented out ControlBar entries"]
        ZH_CMAKE["GeneralsMD CMakeLists:\nCommented out ControlBar entries"]
    end

    ZH -->|"git rename R100"| CORE
    GEN -->|"deleted"| GEN_DEL
    CORE_EMPTY -->|"replaced"| CORE

    CORE --> CORE_CMAKE
    GEN_DEL --> GEN_CMAKE
    CORE --> ZH_CMAKE

    subgraph PopupDiff["ControlBarPopupDescription.cpp additions"]
        P1["+ Hide cost widget when costToBuild == 0"]
        P2["+ missingScience check for upgrade prerequisites"]
        P3["+ Building-specific max-count tooltip with fallback"]
    end

    CORE --> PopupDiff
Loading

Reviews (4): Last reviewed commit: "unify(controlbar): Move ControlBar files..." | Re-trigger Greptile

@stephanmeesters stephanmeesters added Gen Relates to Generals ZH Relates to Zero Hour Unify Unifies code between Generals and Zero Hour labels Jul 1, 2026
@xezon xezon added ZH Relates to Zero Hour and removed ZH Relates to Zero Hour labels Jul 1, 2026
@xezon xezon added this to the Code foundation build up milestone Jul 1, 2026

@xezon xezon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fixed a Base Generals HUD regression where the Generals Powers shortcut bar could disappear

How did Generals regress?

Comment thread Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp Outdated
@stephanmeesters

Copy link
Copy Markdown
Author

How did Generals regress?

This was already fixed in #2680, removed from description

@stephanmeesters stephanmeesters force-pushed the unify/merge-move-controlbar branch from da28ca7 to acdcd4d Compare July 3, 2026 19:05
@stephanmeesters stephanmeesters force-pushed the unify/merge-move-controlbar branch from acdcd4d to e5c1950 Compare July 4, 2026 19:23

@xezon xezon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Commit titles need polishing

@stephanmeesters stephanmeesters force-pushed the unify/merge-move-controlbar branch from e5c1950 to 4c1c2fb Compare July 5, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gen Relates to Generals Unify Unifies code between Generals and Zero Hour ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants