Repository navigation
Reimplement 2 GameStateStructures functions at 100% from #243, plus 1 with register allocation differences - #551
Merged
Conversation
As in sourcehold#243: the original keeps this in edx across the call to updateFoodTypesInStockForAllPlayers, which is already /GL on main. LTCG can only reproduce that with both sides compiled /GL (96.5% without the entry, 100% with it). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
countof instead of the loop bounds 9, 8, 300 and 299; the logic-layer mask in spawnPoisonCloudsAroundBuilding as Logic1 flags (L_SEA | L_BORDER | ... | L_MOAT == 0x4a5014b1); BOOLEnum fields and returns tested directly instead of against FALSE; const on the two assign-once locals of resetVariousCounts...; duplicate own .func.hpp include and unused usings dropped; namespace closing comments. Re-measured on 40cbb1c with a full build and reccmp: the four 100% functions stay 100.0/100.0, resetVariousCountsAndStatisticsAndStartGoodsAndResources stays 92.9/85.5 (register-blind identical). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
- processFoodConsumption and updateCrowding leave this PR: they only match through a local PLAYER_FIELD #define that walks an int pointer through PlayerData (a PlayerData* walk measures 0.48 in quick_diff). Their status lines go back to main's, and so does the /GL entry processFoodConsumption needed. - spawnPoisonCloudsAroundBuilding: map bounds as MC_MAP_XY_LIMIT_MIN_1 / MC_MAP_XY_LIMIT, the logic mask tested by truthiness, const on the two positions, and the match-explaining comment removed (moved into the PR thread). Re-measured on 592a17d with a full build and reccmp: computePopulationStatistics and spawnPoisonCloudsAroundBuilding 100.0/100.0, resetVariousCountsAndStatisticsAndStartGoodsAndResources 92.9/85.5 (register-blind identical). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Contributor
Author
|
Forms in this PR that are kept only for the match:
|
TheRedDaemon
approved these changes
Dec 4, 2026
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.
This PR carries the finished part of draft PR #243 (
reimpl/GameStateStructures):Measured on
origin/main(592a17d, merged in): I built the DLL with exactly these 3 files in the build list, plus main'supdateFoodTypesInStockForAllPlayers, whichcomputePopulationStatisticscalls. The struct resolvers and the function resolvers of those files were switched on, then I ran reccmp.GameStateStructures::computePopulationStatisticsGameStateStructures::spawnPoisonCloudsAroundBuildingGameStateStructures::resetVariousCountsAndStatisticsAndStartGoodsAndResourcesresetVariousCountsAndStatisticsAndStartGoodsAndResources: with register names and stack offsets normalized, the code is the original's instruction for instruction (145 against 145). Several temporaries get a different volatile register (eax/ecx/edx), and that is the only difference. One side effect: ours loads one global through the shortermov eax, [abs]encoding, so the alignment padding before the following loop is one byte longer.Style:
REIMPLEMENTATION_STYLE_GUIDE.md.MC_MAP_XY_LIMIT_MIN_1/MC_MAP_XY_LIMIT.Logic1flags (L_SEA | L_BORDER | ... | L_MOAT== 0x4a5014b1).countof.BOOLEnumvalues are tested directly.usings are removed.Header changes, /GL and function-visibility entries: none.
Left in #243:
processFoodConsumptionandupdateCrowdingare both at 100% in the draft, but they reach it only through a localPLAYER_FIELD#define. It walks anint*throughPlayerDatathe way the original does. APlayerData*walk does not match, so they are kept out of this PR and go to a separate PR for match-driven forms.computeBuildingCategoryEntryPointAndDestroyEarlierBuilding(84.8): the stores toPlayerDatafields are in a different order.processPeasantSpawnAndDespawnCycle(85.3): it has extra field stores and aleawhere the original uses repeatedadds.spawnMotherOrChild(54.6): a different frame and induction variables.Overlap with open PRs: none outside #243 itself.
There is one commit per function, with its line in
status/addresses-SHC-3BB0A8C1.txt, plus astyle:and areview:commit.Draft PR #243 stays open for the remaining functions.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp