Skip to content

Fix 15 files that stopped compiling after the header syncs - #343

Merged
gynt merged 2 commits into
sourcehold:mainfrom
kotijekriv:fix/header-sync-renames
Nov 6, 2026
Merged

gynt merged 2 commits into
sourcehold:mainfrom
kotijekriv:fix/header-sync-renames

Conversation

@kotijekriv

@kotijekriv kotijekriv commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Main (57d3334) has 15 .cpp files that no longer compile in a clean build, because the Ghidra syncs a9401a7 and d972299 renamed or retyped what they use in the headers. This PR moves them to main's names and types and changes nothing else: no header and no status line. All 15 functions stay at 100%, the same as their status lines.

File Was Main's name or type now
AI/AICState/yieldCowThrow.cpp PlayerData.counter availableCows
Game/GameStateStructures/migrateGameStateForMapVersion.cpp PlayerData.counter availableCows
Map/Buildings/UpdateFireBallistaBuilding.cpp PlayerData.counter availableCows
Synchrony/GameSynchronyState/processWaitingCommands.cpp someIndex selectedCommandsCount
UI/Helpers/CheckGoldResource.cpp CheckGoldResource(int) CheckGoldResource(UnitType)
UI/MenuItems/BuildingAndStatusMenu/..._TunnelerPortrait.cpp passes an int to CheckGoldResource a cast to UnitType
UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Buttons.cpp DAT_ArrayOfMapU3EndInt2[0] (an int[501]) DAT_ArrayOfMapU3EndInt2 (an int)
UI/MenuTextInputState/loadOrSaveMap.cpp DAT_ArrayOfMapU3EndInt2[0] DAT_ArrayOfMapU3EndInt2
UI/MenuTextInputState/activateLoadOrSaveMapUI.cpp activateLoadOrSaveMapUI(int), DAT_ArrayOfMapU3EndInt2[0] activateLoadOrSaveMapUI(MenuModalType), DAT_ArrayOfMapU3EndInt2
UI/Rendering/DisplayMapDescriptionAndAllocatePlayersToSlots.cpp DAT_00b95b74 INT_00b95b74
UI/MenuItems/BuildingAndStatusMenu/..._Unknown_Min1.cpp DAT_00df3350 = 0xffffffff INT_00df3350 = -1 (it is an int now)
UI/MenuItems/BuildingAndStatusMenu/..._BarracksWeaponAvailability.cpp DAT_00df3350 INT_00df3350
UI/MenuItems/TutorialBox/MenuItemActionHandler_TutorialBox_Main.cpp DAT_00df5554, INT_DisableTutorialRestrictions INT_00df5554, DAT_DisableTutorialRestrictions
UI/Helpers/UpdateTutorialStepAndProgress.cpp INT_DisableTutorialRestrictions DAT_DisableTutorialRestrictions
Game/GameStateStructures/handleActivateTacticalPowers.cpp passes 1 to spawnUnitsAroundLocation a cast to AITribeType (d972299 retyped the parameter)

The include lines follow the names, sorted by clang-format; the two casts bring their enum's include.

Built with the bundled MSVC1400-SP1, natively on Windows, against the Steam Stronghold Crusader.exe (3bb0a8c1…5387ac5a): a clean full build compiles every reimplemented file and links (15 failures before), and each of the 15 functions measures 100.0% with sourcehold's reccmp (--resolve-wrapped-calls --ignore-security-cookie). status_regression.py finds nothing below a known score.

Left as it is

  • AITribeType has no constant for 1, the type the tactical powers spawn, so handleActivateTacticalPowers casts it. A name for it would be a header change, which is yours to make in Ghidra.
  • cpp-linter checks whole files, so a second commit re-indents one line of processWaitingCommands.cpp (line 38, whitespace only) that clang-format wanted one level shallower.
  • Our openshc-pr-check still flags the first include of UpdateFireBallistaBuilding.cpp, CheckGoldResource.cpp and ..._Unknown_Min1.cpp, which isn't their .func.hpp, and the style bot the while loop in processWaitingCommands.cpp. Both are main's own lines that this PR doesn't touch; we kept it to the renames, and are happy to tidy them here if you'd like.

Other PRs: the ready #342, and the drafts #313, #318, #321, #327 and #328.

🤖 Generated with Claude Code

The Ghidra header syncs a9401a7 and d972299 renamed or retyped fields, globals and parameters that 15
reimplemented files still use in their old form, so those files no longer compile once they are in the build list
(main's committed list is empty, so CI does not see it). This follows a9401a7 (and d972299 for the last
file): each old name becomes the name at the same address in the current header, an array that became a scalar
loses its [0], and a parameter that became an enum gets the header's type or a cast. No header changes and no
behaviour changes. With these, a full build of every reimplemented file compiles and links.

PlayerData: counter -> availableCows (a9401a7)
- AI/AICState/yieldCowThrow.cpp
- Game/GameStateStructures/migrateGameStateForMapVersion.cpp
- Map/Buildings/UpdateFireBallistaBuilding.cpp
GameSynchronyState: someIndex -> selectedCommandsCount (a9401a7)
- Synchrony/GameSynchronyState/processWaitingCommands.cpp
Helpers::CheckGoldResource: int parameter -> UnitType, as the header now declares it (a9401a7)
- UI/Helpers/CheckGoldResource.cpp: the definition takes UnitType
- UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TunnelerPortrait.cpp: the int
  button parameter is cast to Map::Units::UnitType at the call (plus the UnitType.hpp include)
MenuTextInputState: DAT_ArrayOfMapU3EndInt2[501] -> int DAT_ArrayOfMapU3EndInt2, so [0] -> no index (a9401a7)
- UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Buttons.cpp
- UI/MenuTextInputState/loadOrSaveMap.cpp
- UI/MenuTextInputState/activateLoadOrSaveMapUI.cpp, which also takes MenuModalType for its int parameter, as the
  header now declares activateLoadOrSaveMapUI
Globals (a9401a7; include lines re-sorted by clang-format):
- DAT_00b95b74 -> INT_00b95b74: UI/Rendering/DisplayMapDescriptionAndAllocatePlayersToSlots.cpp
- DAT_00df3350 -> INT_00df3350:
  UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_Unknown_Min1.cpp (which now
  stores -1 for 0xffffffff, since the global is an int),
  UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_BarracksWeaponAvailability.cpp
- DAT_00df5554 -> INT_00df5554: UI/MenuItems/TutorialBox/MenuItemActionHandler_TutorialBox_Main.cpp
- INT_DisableTutorialRestrictions -> DAT_DisableTutorialRestrictions:
  UI/MenuItems/TutorialBox/MenuItemActionHandler_TutorialBox_Main.cpp, UI/Helpers/UpdateTutorialStepAndProgress.cpp
TribesState::spawnUnitsAroundLocation: undefined4 param_1 -> AITribeType tribeType (d972299)
- Game/GameStateStructures/handleActivateTacticalPowers.cpp: the literal 1 is cast to AI::Tribes::AITribeType, which
  has no constant for 1 (plus the AITribeType.hpp include)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Style guide reading (advisory, posted once)

2 possible deviation(s) from REIMPLEMENTATION_STYLE_GUIDE.md across 2 of the 15 reimplemented .cpp file(s) in this PR.

The match comes first. Where the ugly form is what matched, it stays -- that is the guide's own overriding rule, and rule 21 asks for a one-line comment saying what was measured so the next reader does not retry it. This report is posted once, when the PR opens, and is not repeated on later pushes.

rule what it asks hits
9 Prefer for over while/do 1
14 The shape of a file 1
Where

Rule 9 — Prefer for over while/do

  • src/OpenSHC/Synchrony/GameSynchronyState/processWaitingCommands.cpp:21 — while-loop; the guide asks for a for

Rule 14 — The shape of a file

  • src/OpenSHC/Map/Buildings/UpdateFireBallistaBuilding.cpp:1 — first include is not Buildings; the folder is the class

cpp-linter checks whole files; line 38 (unchanged by the renames) was indented
one level too deep for clang-format. Whitespace only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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