Skip to content

bugfix(controlbar): Show shortcut special powers in Generals again#2680

Merged
xezon merged 3 commits intoTheSuperHackers:mainfrom
xezon:xezon/fix-generals-shortcut-powers
May 4, 2026
Merged

bugfix(controlbar): Show shortcut special powers in Generals again#2680
xezon merged 3 commits intoTheSuperHackers:mainfrom
xezon:xezon/fix-generals-shortcut-powers

Conversation

@xezon
Copy link
Copy Markdown

@xezon xezon commented May 3, 2026

#2655 broke the Shortcut special powers in Generals. Reason being, Generals does not have the "ShortcutPower" flags set in the INI files.

To support the legacy setup, Generals is satisfied with the presence of the command center again.

@xezon xezon added Bug Something is not working right, typically is user facing GUI For graphical user interface Minor Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ThisProject The issue was introduced by this project, or this task is specific to this project labels May 3, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 3, 2026

Greptile Summary

This PR restores the shortcut special powers bar in vanilla Generals by introducing canShowSpecialPowerShortcut(), a new helper that — under #ifdef RTS_GENERALS — falls back to checking for a command center rather than requiring the ShortcutPower INI flag that Generals never sets. The Zero Hour (GeneralsMD) build carries the same new function but the #ifdef block is inactive there, so its behavior is unchanged.

Confidence Score: 4/5

Safe to merge; only a minor style inconsistency found.

The logic is correct and well-scoped. The only finding is a P2 style issue (lowercase true/false vs the codebase-standard TRUE/FALSE). No logic bugs or regressions were identified.

No files require special attention beyond the style note in both ControlBar.cpp copies.

Important Files Changed

Filename Overview
Generals/Code/GameEngine/Include/GameClient/ControlBar.h Moves hasAnyShortcutSelection() and adds canShowSpecialPowerShortcut() declaration to the public section, grouped with the other shortcut methods.
Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp Adds canShowSpecialPowerShortcut() which uses #ifdef RTS_GENERALS to fall back to a command-center presence check; simplifies updateSpecialPowerShortcut and showSpecialPowerShortcut to use the new helper. Minor style inconsistency: lowercase true/false vs codebase-wide TRUE/FALSE.
GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h Mirrors the Generals header change: moves hasAnyShortcutSelection() and adds canShowSpecialPowerShortcut() to the public shortcut method group.
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp Identical delta to the Generals CPP; #ifdef RTS_GENERALS inside canShowSpecialPowerShortcut() is intentionally inactive for Zero Hour, so behavior is unchanged there. Same true/false style inconsistency.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["updateSpecialPowerShortcut() / showSpecialPowerShortcut()"] --> B["canShowSpecialPowerShortcut()"]
    B --> C{{"#ifdef RTS_GENERALS"}}
    C -- "Generals build" --> D["findNaturalCommandCenter() != nullptr?"]
    D -- "yes" --> E["return true (show bar)"]
    D -- "no" --> F["hasAnyShortcutSelection()?"]
    C -- "Zero Hour build" --> F
    F -- "yes" --> E
    F -- "no" --> G["hasAnyShortcutSpecialPower()?"]
    G -- "yes" --> E
    G -- "no" --> H["return false (hide bar)"]
Loading
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
Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp:3558-3574
**Inconsistent bool literal style**

The new `canShowSpecialPowerShortcut()` returns lowercase `true`/`false`, while every surrounding function in the same file (e.g. `hasAnyShortcutSelection()` returning `TRUE`/`FALSE`) uses the codebase-wide uppercase constants. The same inconsistency exists in the `GeneralsMD` copy of this function.

Reviews (1): Last reviewed commit: "Improve comment text" | Re-trigger Greptile

@xezon xezon merged commit 82d225a into TheSuperHackers:main May 4, 2026
32 of 33 checks passed
@xezon xezon deleted the xezon/fix-generals-shortcut-powers branch May 4, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Gen Relates to Generals GUI For graphical user interface Minor Severity: Minor < Major < Critical < Blocker ThisProject The issue was introduced by this project, or this task is specific to this project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants