Skip to content

Reimplement 33 Map functions at 100% - #401

Open
6and8 wants to merge 3 commits into
sourcehold:mainfrom
6and8:pr-map-100
Open

6and8 wants to merge 3 commits into
sourcehold:mainfrom
6and8:pr-map-100

Conversation

@6and8

@6and8 6and8 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Reimplements 33 Map functions, all at 100%:

  • MapPropertiesState (15): activateScenarioTypeEvents, commitBuildingAvailability, determineScenarioMissionTypeAndResetEvents, getDifficultyMultipliedValue, getEventIDForTimeUntilDefeatEventType, isMapperAvailable, loadMapSiegeHeaderSections, pruneInvalidEventTriggerLinks, removeEventAtIndex, removeProcessedInvasionEvents, resetEuroUnitRestrictions, sortEventsByDate, spawnAttackWaveForPlayer, sumUnitCounts, sumUnitPoints
  • LandscapeState (7): findTree, getValueFrom0UpTo3ForTreeTypeAndTreeStage, placeAppleTree, selectClosestAppleTree, setupBabyTreeLocation, updateTrees, updateWind
  • EntityState (6): drawEntityEffect, initializeSeagullMovementVector, setEntityParameters, setProjectileEntityValues2, setProjectileTargetPosition, updateEntityMicroMovement
  • Entities (3): AFireSpreadFunction, UpdateArrowEntity, UpdateCrossbowArrowEntity
  • Trees (1): UpdateTree5
  • Map (1): ResetSomeValuesFunctionUnk

No header changes. The only status lines touched are these 33.

Checked with a build of this branch on top of main, containing every source file of the touched classes (55 files): all 33 functions measure 100%, and main's own 22 functions in those classes keep their scores. One exception predates this PR: EntityState::activateProjectileEntity is listed at 100% on main but measures 45.5% with or without this PR. The original returns entityID (mov eax, esi before ret 4), while main declares it void.

🤖 Generated with Claude Code

MapPropertiesState (15), LandscapeState (7), EntityState (6), Entities (3), Trees (1), Map (1).
Style: locals at first assignment, decimal literals, clang-format.

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

Copy link
Copy Markdown

Style guide reading (advisory, posted once)

4 possible deviation(s) from REIMPLEMENTATION_STYLE_GUIDE.md across 4 of the 33 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 2
18 Use the name, not the number 1
Where

Rule 9 — Prefer for over while/do

  • src/OpenSHC/Map/MapPropertiesState/spawnAttackWaveForPlayer.cpp:201 — while-loop; the guide asks for a for

Rule 14 — The shape of a file

  • src/OpenSHC/Map/MapPropertiesState/loadMapSiegeHeaderSections.cpp:1 — first include is not MapPropertiesState; the folder is the class
  • src/OpenSHC/Map/ResetSomeValuesFunctionUnk.cpp:1 — first include is not Map; the folder is the class

Rule 18 — Use the name, not the number

  • src/OpenSHC/Map/LandscapeState/placeAppleTree.cpp:26 — hex constant 0x1000; use a name, or decimal

namespace {

// the part of a scenario event up to the end of its condition list
struct ScenarioEventConditionsCopy {

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.

Secret header change! I will add this to the .hpp files and then we can merge.

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.

@6and8 its upstream can you refer to that hpp file here? Or does that change the match?

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.

Done: it now includes OpenSHC/Map/ScenarioEventConditionsCopy.hpp and the local struct is gone. Still 100%. I also made the main includes relative in the whole PR.

gynt added a commit that referenced this pull request Nov 13, 2026
loamifi-jake and others added 2 commits November 15, 2026 20:39

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants