Skip to content

Fix SGSL hilight name table pointing at the wrong item - #151

Closed
Giszmo wants to merge 2 commits into
masterfrom
junior/fix-sgsl-hilight-name-table
Closed

Fix SGSL hilight name table pointing at the wrong item#151
Giszmo wants to merge 2 commits into
masterfrom
junior/fix-sgsl-hilight-name-table

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.

Original commit: c6c71dd

… wrong item

Story::setHighlightItem mapped script hilight names to GameGUI::HilightObject
through a hand-written else-if chain. The "forbidden zone on panel" arm was
copy-pasted from "workers working free stat" and kept its enum constant, so the
name resolved to HilightWorkersWorkingFreeStat instead of
HilightForbiddenZoneOnPanel. The forbidden-zone arrow in
GameGUIDrawMiscPanels.cpp was therefore unreachable, and a script asking for it
got the workers stat arrow instead. No shipped tutorial uses the name, so this
was latent.

Replace the chain with a constexpr table of name/object pairs and a pure
hilightObjectFromName() lookup returning std::optional, which also drops the
int t=0 / if(t!=0) sentinel that relied on the enum starting at 1. A
static_assert rejects any table where two names share an object, turning this
class of copy-paste mistake into a build error.

Verified byte-equal against tests/baselines/cpp-refactor.replay; hilight state
is GUI-only and never reaches a checksum.

Ported from PR #129 (feat/ai-trainer-support), original commit c6c71dd, adapted to master's file layout.

@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.

Requesting changes: the new SGSL implementation does not compile with the repository’s current macOS toolchain/configuration. In a clean integration tree containing the five merged fixes plus PRs #142#152, Apple Clang stopped in src/SGSL.cpp because std::optional, std::nullopt, and std::size are unavailable under the project’s existing language mode. The current SConstruct does not request C++17. Please either use the project-supported language level and compatible facilities, or explicitly update the build configuration across platforms and rerun macOS/Linux/Windows CI. The historical Linux CI result is not sufficient for this cross-platform regression.

@genixpro

genixpro commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Current already contains the corrected SGSL highlight-name table in and now builds with the repository's C++20 mode. The old branch is stale/conflicting and should not be merged as-is.

Resolve the modify/delete conflict by retaining the SGSL module split on master. The highlight-name table, lookup, and setHighlightItem implementation in src/sgsl/StoryActions.cpp are byte-identical to the PR implementation, including the corrected forbidden-zone mapping.

The resulting tree matches master exactly. Verified that StoryActions.cpp compiles through SCons on macOS with the current GNU C++20 language mode.
@kylelutze kylelutze closed this Sep 6, 2026
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.

3 participants