Skip to content

Fix Create Server / Solo Game menu showing wrong End Game Limit for CTF and other gametypes - #463

Open
pdewilde wants to merge 1 commit into
Razish:masterfrom
pdewilde:fix/createserver-ctf-limit
Open

pdewilde wants to merge 1 commit into
Razish:masterfrom
pdewilde:fix/createserver-ctf-limit

Conversation

@pdewilde

Copy link
Copy Markdown

Problem

When selecting Capture The Flag (or other non-FFA gametypes) in the Solo Game / Create Server menu using stock BaseJKA ui/jamp/createserver.menu, the End Game Rules section displays Duel Limit instead of Capture Limit.

Why this happens:

  • Stock createserver.menu controls visibility of Score Limit, Duel Limit, and Capture Limit using cvarTest "ui_netGameType" tested against BaseJKA's 0..5 menu index (0 = FFA, 1 = Duel, 2 = Power Duel, 3 = Team FFA, 4 = Siege, 5 = CTF).
  • JA++ stores the raw gametype_e enum directly in ui_netGameType (0 = GT_FFA, 1 = GT_HOLOCRON, 2 = GT_JEDIMASTER, 3 = GT_DUEL, 4 = GT_POWERDUEL, 6 = GT_TEAM, 7 = GT_SIEGE, 8 = GT_CTF, 9 = GT_CTY).
  • Because GT_CTF (8) does not equal "5", createserver.menu's showCvar / hideCvar expressions evaluate the wrong branch and show Duel Limit.

Fix

  • Add UI_NormalizeMenuCvarTestValue() in ui/ui_shared.cpp, called from Item_EnableShowViaCvar() and Item_EnableShowViaCvar2(), which maps ui_netGameType raw gametype_e values (0..9) to BaseJKA's expected 0..5 index solely when evaluating menu cvarTest rules (without changing the stored value of ui_netGameType itself).
  • Register ui_actualNetGametype in ui/ui_xcvar.h and keep it synced with ui_netGameType in ui/ui_main.cpp for menu scripts that reference it.

Verification

Verified in Solo Game / Create Server across FFA, Duel, Power Duel, Team FFA, Siege, and CTF: CTF/CTY now display Capture Limit, Duel/Power Duel display Duel Limit, and FFA/Team FFA display Score Limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant