Skip to content

Fix swapped hilight arrows for warrior/explorer top-bar counters - #157

Merged
genixpro merged 1 commit into
masterfrom
junior/fix-topbar-hilight-arrows
Sep 6, 2026
Merged

Fix swapped hilight arrows for warrior/explorer top-bar counters#157
genixpro merged 1 commit into
masterfrom
junior/fix-topbar-hilight-arrows

Conversation

@Giszmo

@Giszmo Giszmo commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Bugfix ported from PR #129 (feat/ai-trainer-support), split out to shrink #129's diff against master per Leo's request.

drawTopScreenBar's three-branch chain paired the warrior counter with the explorers hilight and the explorer counter with the warriors hilight — a copy-paste swap. A script requesting the explorers stat drew its arrow over the warrior counter and vice versa. Replaced with a table indexed by the same unit-type index used everywhere else in the loop, so the pairing can't be silently swapped again.

Original commit: d8e69de by kylelutze

The tutorial hilight subsystem draws an arrow over a unit-type's free/total
counter in the top screen bar when the corresponding "working free stat"
hilight is active. The three-branch chain in drawTopScreenBar paired the
warrior counter (i == WARRIOR) with the explorers hilight and the explorer
counter (i == EXPLORER) with the warriors hilight -- a copy-paste swap. As a
result a script requesting the explorers stat drew its arrow over the warrior
counter and vice versa.

Replace the three near-duplicate branches with a single table indexed by i
so the hilight id is driven by the same index as everything else and the
pairing cannot be swapped again. The table order follows the UnitConsts
ordering (WORKER, EXPLORER, WARRIOR), which differs from the Hilight enum's
numeric order, so it is spelled out explicitly.

Pure UI draw path; no simulation, checksum, or replay impact.

Ported from PR #129 (feat/ai-trainer-support), original commit
d8e69de by kylelutze.

@genixpro genixpro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verified the table against UnitConsts.h (WORKER=0, EXPLORER=1, WARRIOR=2), the Hilight IDs, and the counter/sprite loop. Each tutorial highlight now targets its corresponding counter. No blocking findings.

Validation: a clean integration checkout combining #153#158 built successfully with scons release=1 on macOS arm64 and Ubuntu 26.04 x86_64; both binaries passed --version startup checks, and the existing CppUnit suite passed all 12 tests on Linux. This PR also has passing Ubuntu 22.04/24.04 and Windows CI. Validation was source review and automated checks; no interactive gameplay test.

@genixpro
genixpro merged commit fe9b372 into master Sep 6, 2026
3 checks passed
@genixpro
genixpro deleted the junior/fix-topbar-hilight-arrows branch September 6, 2026 00:53
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.

2 participants