Skip to content

Reimplement 10 WildlifeState and LandscapeState functions at 100% from #526 - #549

Open
gynt wants to merge 25 commits into
sourcehold:mainfrom
gynt:reimpl/pr526-matched
Open

gynt wants to merge 25 commits into
sourcehold:mainfrom
gynt:reimpl/pr526-matched

Conversation

@gynt

@gynt gynt commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

This PR carries the finished part of draft PR #526 (reimpl/landscape-wildlife-development): 10 of its 17 functions, all at 100%. No function where only register allocation differs qualified.

Measured on origin/main (592a17d, merged in): I built the DLL with exactly these 10 files in the build list, plus three files that are already on main and that they call (copyData, getValueFrom0UpTo3ForTreeTypeAndTreeStage, GetIfDisplayElementStateNotZero). The struct resolvers and the function resolvers of those files were switched on, then I ran reccmp. All 10 came out at 100.0, normalized 100.0.

Re-measured after merging origin/main c1b50c4 (the upstream Ghidra syncs). The build list held all 29 WildlifeState and LandscapeState sources on the branch, with both resolver sets on. All 29 are at 100.0 / normalized 100.0, including these 10.

Function Address raw % normalized % Status
LandscapeState::createRock 0x004F2140 100.0 100.0 Reimplemented
LandscapeState::updateTreeStage 0x004F3960 100.0 100.0 Reimplemented
WildlifeState::renderDebugDataMapData 0x0052BF40 100.0 100.0 Reimplemented
WildlifeState::floodFillField13FromCell 0x0052C570 100.0 100.0 Reimplemented
WildlifeState::floodFillField20FromCell 0x0052C810 100.0 100.0 Reimplemented
WildlifeState::hasAdjacentCellWithField24Or25 0x0052D620 100.0 100.0 Reimplemented
WildlifeState::isAttackStagingCandidateCell 0x0052D690 100.0 100.0 Reimplemented
WildlifeState::floodFillZoneProximityFromCell 0x0052D720 100.0 100.0 Reimplemented
WildlifeState::floodFillCasDisFromSignpost 0x0052D9D0 100.0 100.0 Reimplemented
WildlifeState::updateWildlife 0x0052DF30 100.0 100.0 Reimplemented

Style:

  • The code follows REIMPLEMENTATION_STYLE_GUIDE.md, and the class's own .func.hpp is the first include.
  • countof replaces the grid, BFS-queue, rock-array and direction bounds.
  • MC_MAP_SECTOR_SIZE, Trees::TSE_TO_BE_REMOVED, the TT_SHRUB_* range and LogicHelpers::L_TREE replace numbers.
  • The debug labels come from string-literals.hpp.
  • param_N parameters are named.
  • Forms that are kept only for the match, and the header types that look wrong, are listed in a comment on this PR.

Header changes (one commit each, made for review comments):

  • Tree::stageRelated2: undefined2 → short. The stage comparison is a signed word compare, and the cast goes away.
  • LandscapeState::createRock(int x, int y, RockType rockType, int size, int orientation), previously undefined4s.
  • New Map/Enums/DebugDataMapDataDisplayType (DDMDDT_CONNECT … DDMDDT_SLINK) with an Int variant. WildlifeState::DAT_DebugDataMapDataDisplayType uses it.
  • updateTreeStage's second parameter is renamed rng → stageSlot.

TreeStateEnum (with TSE_ values) and TreeStateEnumShort come from main. Re-measured after these changes (merged origin/main 33cdd1f): all 29 WildlifeState/LandscapeState sources on the branch are at 100.0 / 100.0.

/GL entries (cmake/compiler-flags-gl.txt):

  • updateWildlife and its callees floodFillField13FromCell/floodFillField20FromCell;
  • updateTreeStage and main's existing getValueFrom0UpTo3ForTreeTypeAndTreeStage, which it calls. LTCG has to see both sides of each call.

Every other file matches without /GL. No function-visibility entries.

Left in #526:

  • updateSection1034Info is at 100% in the draft, but only through a volatile read of its pass counter. It goes to a separate PR for match-driven forms.
  • createTree (89.6): stores to tree fields are in a different order.
  • spawnCrowFromNearbyTree (98.3), buildRallyPointPathForTribe (98.0), findAndSetNewRallyPointForDeerAndLions (96.1) and updateWildlifeGrid (87.5): the original has extra unthreaded jmp blocks.
  • updateNofFpoints (77.5): the map base is folded into the induction variable.

Overlap with open PRs: #292 carries six of these files, each a different version from the one here: floodFillCasDisFromSignpost, floodFillField13FromCell, floodFillField20FromCell, floodFillZoneProximityFromCell, hasAdjacentCellWithField24Or25 and isAttackStagingCandidateCell. Whichever PR is merged second will conflict on those files.

There is one commit per function, each setting status/addresses-SHC-3BB0A8C1.txt to 100.0% | Reimplemented, plus style:/review: commits and the header commits above.

Draft PR #526 stays open for the remaining functions.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp

gynt and others added 12 commits December 4, 2026 15:12
…cehold#526 with /GL

The nine /GL entries from sourcehold#526 for the functions this PR carries (hasAdjacentCellWithField24Or25, isAttackStagingCandidateCell, floodFillZoneProximityFromCell, floodFillCasDisFromSignpost, updateSection1034Info, floodFillField13FromCell, floodFillField20FromCell, updateWildlife, updateTreeStage), plus main's getValueFrom0UpTo3ForTreeTypeAndTreeStage as in sourcehold#526: updateTreeStage calls it, and LTCG must see both sides for the caller to match.

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
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
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

Style guide reading (advisory, posted once)

29 possible deviation(s) from REIMPLEMENTATION_STYLE_GUIDE.md across 11 of the 11 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
8 Let the compiler unroll 2
9 Prefer for over while/do 4
14 The shape of a file 11
18 Use the name, not the number 11
24 Declare variables upon first use 1
Where

Rule 8 — Let the compiler unroll

  • src/OpenSHC/Map/WildlifeState/hasAdjacentCellWithField24Or25.cpp:14 — loop steps by 2; try the plain loop and let MSVC unroll
  • src/OpenSHC/Map/WildlifeState/isAttackStagingCandidateCell.cpp:23 — loop steps by 2; try the plain loop and let MSVC unroll

Rule 9 — Prefer for over while/do

  • src/OpenSHC/Map/WildlifeState/floodFillCasDisFromSignpost.cpp:36 — while-loop; the guide asks for a for
  • src/OpenSHC/Map/WildlifeState/floodFillField13FromCell.cpp:19 — while-loop; the guide asks for a for
  • src/OpenSHC/Map/WildlifeState/floodFillField20FromCell.cpp:19 — while-loop; the guide asks for a for
  • src/OpenSHC/Map/WildlifeState/floodFillZoneProximityFromCell.cpp:19 — while-loop; the guide asks for a for

Rule 14 — The shape of a file

  • src/OpenSHC/Map/LandscapeState/createRock.cpp:1 — first include is not LandscapeState; the folder is the class
  • src/OpenSHC/Map/LandscapeState/updateTreeStage.cpp:1 — first include is not LandscapeState; the folder is the class
  • src/OpenSHC/Map/WildlifeState/floodFillCasDisFromSignpost.cpp:1 — first include is not WildlifeState; the folder is the class
  • src/OpenSHC/Map/WildlifeState/floodFillField13FromCell.cpp:1 — first include is not WildlifeState; the folder is the class
  • src/OpenSHC/Map/WildlifeState/floodFillField20FromCell.cpp:1 — first include is not WildlifeState; the folder is the class
  • src/OpenSHC/Map/WildlifeState/floodFillZoneProximityFromCell.cpp:1 — first include is not WildlifeState; the folder is the class
  • src/OpenSHC/Map/WildlifeState/hasAdjacentCellWithField24Or25.cpp:1 — first include is not WildlifeState; the folder is the class
  • src/OpenSHC/Map/WildlifeState/isAttackStagingCandidateCell.cpp:1 — first include is not WildlifeState; the folder is the class
  • src/OpenSHC/Map/WildlifeState/renderDebugDataMapData.cpp:1 — first include is not WildlifeState; the folder is the class
  • src/OpenSHC/Map/WildlifeState/updateSection1034Info.cpp:1 — first include is not WildlifeState; the folder is the class
  • ... and 1 more

Rule 18 — Use the name, not the number

  • src/OpenSHC/Map/LandscapeState/updateTreeStage.cpp:100 — hex constant 0x1000; use a name, or decimal
  • src/OpenSHC/Map/WildlifeState/renderDebugDataMapData.cpp:35 — hex constant 0xFFFFFF; use a name, or decimal
  • src/OpenSHC/Map/WildlifeState/renderDebugDataMapData.cpp:38 — hex constant 0xFFFFFF; use a name, or decimal
  • src/OpenSHC/Map/WildlifeState/renderDebugDataMapData.cpp:41 — hex constant 0xFFFFFF; use a name, or decimal
  • src/OpenSHC/Map/WildlifeState/renderDebugDataMapData.cpp:44 — hex constant 0xFFFFFF; use a name, or decimal
  • src/OpenSHC/Map/WildlifeState/renderDebugDataMapData.cpp:47 — hex constant 0xFFFFFF; use a name, or decimal
  • src/OpenSHC/Map/WildlifeState/renderDebugDataMapData.cpp:50 — hex constant 0xFFFFFF; use a name, or decimal
  • src/OpenSHC/Map/WildlifeState/renderDebugDataMapData.cpp:53 — hex constant 0xFFFFFF; use a name, or decimal
  • src/OpenSHC/Map/WildlifeState/renderDebugDataMapData.cpp:56 — hex constant 0xFFFFFF; use a name, or decimal
  • src/OpenSHC/Map/WildlifeState/renderDebugDataMapData.cpp:59 — hex constant 0xFFFFFF; use a name, or decimal
  • ... and 1 more

Rule 24 — Declare variables upon first use

  • src/OpenSHC/Map/LandscapeState/createRock.cpp:16 — declare _rockID where it is first assigned

gynt and others added 3 commits December 4, 2026 15:28
…eState functions

The class's own .func.hpp as the first include (Map.func.hpp and duplicate includes dropped); countof instead of the grid, BFS queue, rock array and direction bounds (40, 39, 1600, 4000, 8); the BFS while loops as for loops; self-increments; TreeType names for the shrub range in updateTreeStage and LogicHelpers::L_TREE instead of 0x1000; the debug-view labels from string-literals.hpp; param_1/param_2 named cellX/cellY; BOOLEnum returns tested directly; unused usings dropped; namespace closing comments.
Re-measured on 40cbb1c with a full build and reccmp: all eleven stay at 100.0/100.0.

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
- updateSection1034Info leaves this PR: it only matches through a volatile read of its pass counter. Its status line goes back to main's, and its /GL entry goes too.
- The /GL entries of hasAdjacentCellWithField24Or25, isAttackStagingCandidateCell, floodFillZoneProximityFromCell and floodFillCasDisFromSignpost are dropped: without updateSection1034Info they are not needed (all still 100%).
- updateTreeStage stores Trees::TS_TO_BE_REMOVED instead of 3; floodFillCasDisFromSignpost divides by MC_MAP_SECTOR_SIZE; a comment restating createRock's loop is removed.
Re-measured on 592a17d with a full build and reccmp: all ten functions 100.0/100.0.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
@gynt gynt changed the title Reimplement 11 WildlifeState and LandscapeState functions at 100% from #526 Reimplement 10 WildlifeState and LandscapeState functions at 100% from #526 Dec 4, 2026
@gynt

gynt commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Forms in this PR that are kept only for the match, and header types that look wrong:

  • All grid functions: the bounds checks are written as x > countof(this->grid) - 1, matching the original's cmp 39/ja. In findAppropriateGridLocationForBuilding (Reimplement 2 AIVState functions at 100% from #233, plus 2 with register allocation differences #553), the >= form cost 5.5 points.
  • createRock: the parameters are now int x, int y, RockType rockType, int size, int orientation (0633805). The original reads x/y as dwords (mov edi, dword ptr [esp+..]); with short x, short y MSVC loads words instead (mov di, word ptr), which is why that variant fell to 94.1 / 91.7. The tile is computed from the stored short fields (rocks[id].x + translationMatrix[rocks[id].y]), which gives the same movsx code without casts.
  • updateTreeStage:
    • Tree::stageRelated2 is now short (4524b11), so the stage comparison needs no cast.
    • (TreeType)this->trees[treeID].treeType converts the TreeTypeShort field for createTree's TreeType parameter.
  • updateWildlife / floodFillField13FromCell / floodFillField20FromCell / updateTreeStage: kept in compiler-flags-gl.txt, because the caller needs LTCG to see its callees.
  • floodFillCasDisFromSignpost: (short)x / (short)y stay on the two queue stores. x and y are int locals here, and without the casts the code changes. The same casts in the other three flood fills, on int parameters, were removed.

TreeState.hpp/TreeStateShort.hpp become TreeStateEnum.hpp/TreeStateEnumShort.hpp, the types TreeStateEnum/TreeStateEnumShort, and the values TSE_UNUSED, TSE_SPAWNED, TSE_ALIVE, TSE_TO_BE_REMOVED and TSE_STATIC. Tree.hpp's state field and updateTreeStage follow. This frees the TS_ prefix for the TribeState enum in sourcehold#555 (TS_FREE, TS_ACTIVE, TS_EMPTY). A rename only: updateTreeStage compiles and its quick_diff output is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
@github-actions github-actions Bot added the declaration/type change This requires changes to the generated/exported types or definitions. label Dec 4, 2026
gynt added a commit to gynt/OpenSHC that referenced this pull request Dec 4, 2026
Main's TreeState enum is renamed to TreeStateEnum with TSE_ values in sourcehold#549, which frees TS_ again, so the tribe states return to TS_FREE, TS_ACTIVE and TS_EMPTY. A rename only; quick_diff output for createTribe and removeUnitFromTribe is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
gynt added a commit to gynt/OpenSHC that referenced this pull request Dec 4, 2026
This aligns the enum with sourcehold#555, which carries the same two files
byte for byte, so the two PRs do not conflict. TS_ becomes free once
sourcehold#549 renames TreeState to TreeStateEnum (TSE_).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
gynt added a commit to gynt/OpenSHC that referenced this pull request Dec 4, 2026
This aligns the enum with sourcehold#554, which carries the same two files
byte for byte, so the two PRs do not conflict:
- Map/Enums is main's folder for these headers; Map/Units/Enums does
  not exist on main.
- TS_FREE becomes TS_UNUSED and TS_EMPTY becomes TS_DISBANDED.
- TS_ is free once sourcehold#549 renames TreeState to TreeStateEnum (TSE_).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Main's upstream Ghidra sync (0701799) renames TreeState to TreeStateEnum.
TreeStateEnum.hpp, TreeStateEnumShort.hpp and Tree.hpp are taken from main,
so this branch no longer changes them. Main keeps the TS_ value names, so
updateTreeStage goes back to Trees::TS_TO_BE_REMOVED.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
@github-actions github-actions Bot removed the declaration/type change This requires changes to the generated/exported types or definitions. label Dec 4, 2026
gynt added a commit to gynt/OpenSHC that referenced this pull request Dec 4, 2026
These files are byte-identical to the ones in sourcehold#554 and sourcehold#555:
TS_UNUSED = 0, TS_ACTIVE = 2, TS_DISBANDED = 3. The TS_ prefix relies
on sourcehold#549 renaming TreeState's values to TSE_.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Main's upstream Ghidra sync (c1b50c4) renames the TreeStateEnum values to
TSE_; updateTreeStage follows with Trees::TSE_TO_BE_REMOVED.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
namespace Map {

// FUNCTION: STRONGHOLDCRUSADER 0x004F2140
int LandscapeState::createRock(undefined4 x, undefined4 y, int rockType, undefined4 size, undefined4 orientation)

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.

Types known?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Typed them: createRock(int x, int y, RockType rockType, int size, int orientation) (0633805). The original reads x and y as dwords (mov edi, dword ptr [esp+..]), so they are int, not short. Still 100%.

this->rocks[rockID].orientation = (short)orientation;
this->rocks[rockID].unknownGMID = (short)DAT_OrganismDefinedData::instance.Rock_field0xe[rockType];
DAT_CurrentRockID::instance = rockID;
(*DAT_OrganismDefinedData::instance.RockTypeFunctions[this->rocks[rockID].type])();

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.

Typing wrong? Can a function ptr not be directly called? I may remember wrong, though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, it can be called directly; the typedef was fine. It is now RockTypeFunctions[this->rocks[rockID].type](); (0633805), and the code is identical.

Comment on lines +25 to +33
this->rocks[rockID].size = (short)size;
this->rocks[rockID].y = (ushort)y;
this->rocks[rockID].one = 1;
this->rocks[rockID].type = (short)rockType;
this->rocks[rockID].x = (ushort)x;
this->rocks[rockID].tile
= (int)(short)(ushort)x + DAT_ViewportRenderState::instance.translationMatrix[(short)(ushort)y].addXgetTile;
this->rocks[rockID].orientation = (short)orientation;
this->rocks[rockID].unknownGMID = (short)DAT_OrganismDefinedData::instance.Rock_field0xe[rockType];

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.

Casts needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

All casts are gone (0633805). The tile now reads the stored short fields (rocks[id].x + translationMatrix[rocks[id].y]), which gives the original movsx code. short x, short y parameters scored 94.1 / 91.7 because MSVC then loads words (mov di, word ptr) where the original loads dwords, so the parameters are int.

return;
}
}
if ((this->trees[treeID].rng1 & 0x3fU) != rng) {

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.

What does this value mean?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updateTrees draws a random slot 0-63 every eighth tick and passes it in. A tree only advances when the low 6 bits of its rng1 match, so stage updates are spread over the trees. I renamed the parameter rng → stageSlot and added a one-line comment (bb64bd5).

MACRO_CALL_MEMBER(Map::Navigation::PathFindingState_Func::updatePathLinkagesInAllEightDirections,
DAT_PathFindingState::ptr)(this->trees[newTreeID].yPosition, this->trees[newTreeID].tile);
DAT_GameState::instance.mapAndTime.newOrganisms++;
DAT_PathFindingState::instance.toggleUpdateSeparateAreaTileMap = 1;

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.

Toggle? So boolean-like?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes: it is a dirty flag. About 20 writers set it to 1, and updateSeparateAreaTileMap (0x4995E0) tests it and clears it to 0. It is now set with TRUE (bb64bd5). Making the field a BOOLEnum would need edits in those ~20 main files, so I left the field type alone.

MACRO_CALL_MEMBER(UI::Rendering::PencilRenderCore_Func::drawColorBox,
DAT_PencilRenderCore::ptr)(x1 + column * 10 + 1, y + row * 10 + 1, x1 + column * 10 + 9,
y + row * 10 + 9, COL_BLUE::instance.shortValue);
} else if (areaColour == 1) {

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.

Do this color indexes relate to something?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No. separateAreaID & 7 just cycles 8 colours, so neighbouring areas get different colours; 0 means no area (blue). It does not index anything else, so there is no enum for it.

DAT_PencilRenderCore::ptr)(x1 + column * 10 + 1, y + row * 10 + 1, x1 + column * 10 + 9,
y + row * 10 + 9, COL_VERY_DARK_GREY::instance.shortValue);
}
} else if (this->DAT_DebugDataMapDataDisplayType == 1) {

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.

Is this an enum?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. I added Map/Enums/DebugDataMapDataDisplayType (DDMDDT_CONNECT = 0 … DDMDDT_SLINK = 9, named after the caption each mode prints) and made the field DebugDataMapDataDisplayTypeInt (803c7b2). Still 100%.

gynt and others added 7 commits December 5, 2026 00:41
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Every removed cast was checked one at a time: the file's /FA listing is
identical without it and no new warning appears.

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
updateTreeStage compares it as a signed word against the short
stageRelated1 (0x4F39D7: cmp dx, word ptr [esi+0x90]; jl), so the
(short) cast at the use site goes away. updateTreeStage is the only
reimplemented user; it stays at 100%.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
(undefined4, undefined4, int, undefined4, undefined4) becomes
(int x, int y, RockType rockType, int size, int orientation).
The original reads x and y as dwords (mov edi/ecx, dword ptr [esp+..]),
so they are ints; short parameters make MSVC load words instead. rockType
indexes the per-type tables. The tile is computed from the stored short
fields, which drops the (short) casts, and the callback is called
directly. createRock has no reimplemented callers; it stays at 100%.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
WildlifeState::DAT_DebugDataMapDataDisplayType selects which wildlife
grid layer renderDebugDataMapData draws; each value 0 to 9 prints its own
caption (Connect, Chimps, Farmland, Humans, Mankind, Deer, Route, Panic,
Siege, Slink). The field becomes DebugDataMapDataDisplayTypeInt (int), so
no user changes codegen; renderDebugDataMapData compares against the
DDMDDT_ names and stays at 100%.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
updateTrees draws one random slot (0 to 63) every eighth tick and passes
it in; a tree advances only when the low six bits of its rng1 match, so
the parameter is renamed from rng to stageSlot (also in the header) and a
one-line comment explains the 0x3f mask.
toggleUpdateSeparateAreaTileMap is a dirty flag (set to 1 by its writers,
tested and cleared by updateSeparateAreaTileMap), so it is set with TRUE.
Stays at 100%.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
@github-actions github-actions Bot added the declaration/type change This requires changes to the generated/exported types or definitions. label Dec 5, 2026
@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-format (v22.1.2) reports: 1 file(s) not formatted
  • src/OpenSHC/Map/LandscapeState.hpp

✨ Powered by cpp-linter • 💬 Feedback

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

declaration/type change This requires changes to the generated/exported types or definitions.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants