Fix swapped hilight arrows for warrior/explorer top-bar counters - #157
Merged
Conversation
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
approved these changes
Sep 6, 2026
genixpro
left a comment
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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