Repository navigation
Conversation
placeSiegeTentsAndAssignEngineers reads the per-player MappersEnum[9] array at 0x00B4C7CC and the int[9] array at 0x00B4D0F0. Main has no header for either, so this adds both (resolver false, as generated) and their two Address enum entries. Taken unchanged from the draft branch of sourcehold#275. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…old#275 The same 13 entries the draft sourcehold#275 uses: the callers and callees that need /GL on both sides so MSVC omits the repeated mov ecx, this. setWhetherTribeContainsAnyUnits is already reimplemented on main; it is listed because addUnitToTribe calls 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
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
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
sourcehold#554 carries TribesState::addUnitToTribe too, written `size++` where this branch had `++size`. Taking its exact text makes the two PRs add an identical file, so whichever merges second has no conflict on it. Still 100.0 / normalized 100.0 (full build and reccmp on f28b77b). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…eSiegeTentsAndAssignEngineers The style pass dropped sourcehold#528's comment, but the statement order it explains is still load-bearing for the 100% match. Comment-only change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Brings in 592a17d, which fixes findBestAttackTileByPathCost's return type. 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
Tribe::tribeState takes three values in the reimplemented code: 0 for a free slot, 2 once createTribe has set the tribe up, and 3 once a tribe has been emptied or given up. 1 is never written. TRS_ is used because TS_ already belongs to TreeState. TribeStateShort matches the short field. Tribe.hpp still declares the field as plain short and is left unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
- Named constants instead of magic numbers: - TribeState (TRS_*) for tribeState; - AIInfoFlag for the AI info layer bits; - SSS_UNUSABLE for siege spot scores; - the Logic1 flags for the keep/wall test; - STBT_0x410_SIEGE_EQUIPMENT_CONSTRUCTION; - countof() instead of literal table sizes. - Removed redundant casts. - TRUE/FALSE returns, and truthiness for the dying/tribeID tests. - const on locals that are assigned once, and `+=` instead of a self-assignment. - "Mace_s4.wav" now comes from string-literals.hpp. - Removed a dead security-cookie read. - Removed unused includes. initializeOrAdvanceAttackWave keeps Map.func.hpp because its code changes without it. - Removed the comments that only explained a form kept for the match; they are now in a PR comment. Also removed a stale comment on the size of the tent point table. Every function keeps its score in a full reccmp build. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
|
Pre-review notes: forms kept only for the match, and header types that look wrong. The code comments that used to explain these forms have been removed and are collected here. The percentages are from a full reccmp build where marked "reccmp". The others are findEnemyLord
ifNecessaryThrowOilAutomatically
placeSiegeTentsAndAssignEngineers
assignBehaviorTypeAndLinkSupportTribe
updateInProgressAttackWave
initializeOrAdvanceAttackWave
Casts kept for the match (the
Header types (generated headers, left unchanged)
Splitting AttackInfoDefinedData: measured, not pushed
I tried a split so that nothing overlaps:
Each new part got its own Globals header, Full build, both resolver sets on, raw / normalized:
Neither of the two drops comes from changed source. Both functions read only the first part ( So the overlap stays, and the split is not part of this PR. |
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
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
…-matched Conflicts: - cmake/compiler-flags-gl.txt: kept both the PR's entries and main's. - src/precomp/addresses-SHC-3BB0A8C1.hpp: took main's version, because main's headers lead. 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
- Main's AttackInfoDefinedData now declares `MappersEnum field_0xc8[9]`, which is the array at 0xB4C7CC. DAT_ARRAY_00b4c7cc.hpp is removed, and placeSiegeTentsAndAssignEngineers reads DAT_AttackInfoDefinedData::instance.field_0xc8[k]. - The 5999 comparisons use main's new SSS_UNUSABLE_THRESHOLD. - initializeOrAdvanceAttackWave includes Map/Enums/TribeState.hpp. With main's smaller struct declaration the function dropped from 100% to 46.8%: the compiler gives the &attackWaveTicker[attackWave] address its own register instead of attackWave. Declaring a few more names in the translation unit restores the original allocation, and so does the old header. Of the includes tried, this one restores 100%. Every function keeps its score in a full reccmp build. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
This completes 931d540, which only removed the header. - placeSiegeTentsAndAssignEngineers reads DAT_AttackInfoDefinedData::instance.field_0xc8[k] instead of DAT_ARRAY_00b4c7cc. - The 5999 comparisons use main's new SSS_UNUSABLE_THRESHOLD, in calculateTile2MoatValueClosestToUnit, findEnemyTowersOrGates, findNearestAvailableScalePoint, getClosestWideValueBasedOnPlayer and setGate2/setMoat3/setScale3/setWide3. - initializeOrAdvanceAttackWave includes Map/Enums/TribeState.hpp. With main's smaller AttackInfoDefinedData declaration, the function dropped from 100% to 46.8%. The compiler gave the &attackWaveTicker[attackWave] address its own register instead of attackWave. Declaring a few more names in the translation unit restores the original allocation, and so does the old header. Of the includes tried, this one restores 100%. Every function keeps its score in a full reccmp build. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
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 AttackInfoDefinedData declares `MappersEnum field_0xc8[9]`, which is the array at 0xB4C7CC. The previous commit removed DAT_ARRAY_00b4c7cc.hpp together with the TribeState headers, and placeSiegeTentsAndAssignEngineers now reads DAT_AttackInfoDefinedData::instance.field_0xc8[k]. - The 5999 limit checks use main's new SSS_UNUSABLE_THRESHOLD. - initializeOrAdvanceAttackWave dropped from 100% to 46.8% with main's smaller struct declaration. It now takes sourcehold#554's version, which includes Map/Enums/TribeState.hpp and is back at 100%. - sortAttackInfoTribeIDArrayBasedOn: 76.0% -> 85.1%. The struct no longer overlaps the array labels, so the status line is updated. Normalized it is 68.0%, down from 71.5%. 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
Main's 87e40b6 adds Map/Enums/TribeState.hpp and TribeStateShort.hpp, byte-identical to this branch's copies. 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
…ound flag Each support-tribe search sets found and breaks; the second search runs only when the first found nothing, and the link block runs when found is set. Same code as the goto form. 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
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
This PR takes the finished part of draft #275 (
reimpl/TroopValueState). It has 78 functions that reccmp puts at normalized 100%: 77 inTroopValueStateandTribesState::addUnitToTribe. It also has six functions where only register allocation differs:computeSiegeSpotScores,updateTribeBehaviorBasedOnBehaviorType,initializeAttackWaveSlotandpruneStaleArcherPoints/pruneStaleSupportPoints/pruneStaleTentPoints.The files come from the draft's last commit (4ae047f) with
git checkout, on top oforigin/main. Nothing else from the draft is in here. The draft also carries:Measured on
origin/main55fa231 (merged into this branch; it includes the ghidra changes in 0701799, c1b50c4 and 87e40b6), after the goto-free rewrite ofassignBehaviorTypeAndLinkSupportTribe. Earlier measurements were on 592a17d, 40cbb1c, 06cdd81 and c1b50c4. I built the DLL with a full build (build_parallel.py -j 3) and then ran reccmp. The build list held:Both resolver sets were switched on: the function resolvers through
.local, and the struct resolvers throughenable_reimplemented_data.py. None of the 78 dropped on main's headers. I measured again after the style pass (below), after merging 592a17d, 06cdd81 and c1b50c4, with the same result each time. The table shows the numbers from the last run.Register allocation only. For each of these, I compared the reccmp diff with registers, stack slots and jump displacements normalized. All remaining lines are of these kinds, and none changes behaviour:
Block layout, store order, instruction selection and computation all match the original. Each has main's status remark
<pct>% | Register allocation differs.computeSiegeSpotScores(96.4 / 92.0): register swaps and base/index order.updateTribeBehaviorBasedOnBehaviorType(97.5 / 82.8):unknownAttackRelatedUpdateCounterincrement and reload are scheduled two instructions earlier, with an extramovzx ecx, axcopy.[eax+eax+X]before the finaladd eax, eaxinstead of after it. The argument pushes are the same values in the same order.jmp $+5; lea ecx,[ecx]loop-alignment pad becomes a 1-bytenop, and the jump-table entries shift accordingly.initializeAttackWaveSlot(96.9 / 91.3): one argumentpush esiand themov ecx, LowLevelMemoryload swap places with theattackWaveTickerstore. The order of the memory stores is unchanged.pruneStaleArcherPoints/pruneStaleSupportPoints/pruneStaleTentPoints(80.5 / 78.4 each):eax, which is known to be 0 at that point, where ours pushes the immediate0, and there is a register swap.TribesState::addUnitToTribeTroopValueState::addUnitToNewTribeTroopValueState::advanceAttackWaveStagingTroopValueState::aiControlNonSkirmishUnitMovementTroopValueState::aiRecomputeAttacksTroopValueState::aiRecomputeAttacks2TroopValueState::applyTribeBehaviorTypesTroopValueState::assignBehaviorTypeAndLinkSupportTribeTroopValueState::assignMacemenAndKnightsNotFromPlayer1ToTribesTroopValueState::assignTribeToSupportPointTroopValueState::buildRallyPointsFromSiegeUnitsTroopValueState::calculateArch2ClosestToTribeTargetUnitTroopValueState::calculateHigh2ClostestToTribeTargetUnitTroopValueState::calculateTile2MoatValueClosestToUnitTroopValueState::calculateTile2PeoplValueClosestToUnitTroopValueState::claimArcherAttackPointTroopValueState::collectArcherUnitsByLocationTroopValueState::commandUnitsToMoveToKeepTroopValueState::computeAttackWaveTroopCompositionTroopValueState::countAvailablePeopleValueSlotsTroopValueState::decideAndExecuteTribeAttackActionTroopValueState::decrementTileMap1104TroopValueState::executeDelayedAttackWaveTargetAssignmentTroopValueState::exitSiegeEquipmentForWaveTroopValueState::expandAIZoneLayerStage1TroopValueState::expandAIZoneLayerStage2TroopValueState::expandAIZoneLayerStage3TroopValueState::findEnemyBuildingsClosestToUnitTroopValueState::findEnemyLordTroopValueState::findEnemyTowersOrGatesTroopValueState::findEnemyWallsTroopValueState::findNearestAvailableScalePointTroopValueState::findNearestDiggableMoatPointTroopValueState::findOrReserveArcherPointSlotTroopValueState::findTribeWithMoatAttackBehaviorTroopValueState::getClosestWideValueBasedOnPlayerTroopValueState::getPlayerNot1AndHasKeepTroopValueState::getSiegeIndexForTileTroopValueState::getSupportPointIndexTroopValueState::getValueOfTroopTypeTroopValueState::giveLightPitchInstructionToUnitClosestToPitchTroopValueState::ifNecessaryThrowOilAutomaticallyTroopValueState::initializeAttackZoneSearchTroopValueState::initializeOrAdvanceAttackWaveTroopValueState::isLessThanPercentageOfTribesInAttackDyingTroopValueState::moveTowardsParticularUnitsTroopValueState::moveTribeToNearbyGatehouseTroopValueState::moveTribeToReachableNearbyTileTroopValueState::placeSiegeTentAtAttackAngleTroopValueState::placeSiegeTentsAndAssignEngineersTroopValueState::placeTunnelEntrancesTroopValueState::placeTunnelForEveryTunnelerTroopValueState::playAttackAlarmSoundTroopValueState::processSpottedEnemyTilesTroopValueState::queueOilThrowForIdleArchersTroopValueState::recomputeTargetedBuildingTilesArrayTroopValueState::recomputeTotalTroopValueOfTroopsNearKeepTroopValueState::recountTotalTroopValueTroopValueState::redeployArchersToDefensivePositionsTroopValueState::registerSpottedEnemyTileTroopValueState::renderAttackInfoDebugOverlayTroopValueState::scanForArcherPointsTroopValueState::scanForSupportPointsTroopValueState::searchTribeWithPropertiesTroopValueState::sendAttackingPatrolTribeToComputedDestinationTroopValueState::setGate2TroopValueState::setMoat3TroopValueState::setRallyPointForLaddermenTribeTroopValueState::setScale3TroopValueState::setTown2TroopValueState::setWide3TroopValueState::shouldLightPitchBasedOnTroopValueTroopValueState::trySendKnightTribeToAttackTroopValueState::trySendMacemenTribeToAttackTroopValueState::updateActiveAttackWaveStateTroopValueState::updateArcherBrazierProximityFlagsTroopValueState::updateAttackInfoTickTroopValueState::updateInProgressAttackWaveTroopValueState::computeSiegeSpotScoresTroopValueState::updateTribeBehaviorBasedOnBehaviorTypeTroopValueState::initializeAttackWaveSlotTroopValueState::pruneStaleArcherPointsTroopValueState::pruneStaleSupportPointsTroopValueState::pruneStaleTentPointsStyle pass. Every file follows
REIMPLEMENTATION_STYLE_GUIDE.mdas it is on main now. The style changes are folded into the per-function commits:usingdeclarations are dropped in 14 files.x = x + 1/x = x | 0x10(++,--,+=,|=).param_Nnames became real names in four functions:assignBehaviorTypeAndLinkSupportTribe:attackWave,playerID,behaviorType,updateLimitBase,updateLimitStep;initializeOrAdvanceAttackWave:attackWave;placeSiegeTentsAndAssignEngineers:attackWave,useAttackAngle;shouldLightPitchBasedOnTroopValue:unusedUnk.AITT_CATAPULT/AITT_TREBUCHET/AITT_FIRE_BALLISTAreplace(AITribeType)0x16..0x18.exitSiegeEquipmentForWave, tribe types 19 to 21 have no name yet, so they stay as decimal literals with a comment.countof(DAT_TribesState::instance.tribes)andcountof(DAT_TileMapState::instance.AIInfoLayer)replace1250and80400.50,20,30, andfield_0x3c5 = 34.scanForArcherPointscompared against a raw'\x02'control character in the source. It now compares against2.forloops replace the guarded do-while ingiveLightPitchInstructionToUnitClosestToPitchand the plainwhileloops inplaceSiegeTentsAndAssignEngineersandplaceTunnelForEveryTunneler.findEnemyLord, theforform measured 92.1% instead of 100%, so I reverted it.ifNecessaryThrowOilAutomatically, the loop body sets the count it runs to.assignMacemenAndKnightsNotFromPlayer1ToTribesandplaceSiegeTentsAndAssignEngineersnow include their own../TroopValueState.func.hppfirst.initializeAttackWaveSlot's parameters namedattackWave/signpostChoice;0instead of'',16/-1/96instead of hex;countof(...playerInfo)instead of8.review:commit):TribeState(TS_*) fortribeState;AIInfoFlagfor the AI info layer bits;SSS_UNUSABLEfor the siege spot scores;Logic1keep/wall flags;STBT_0x410_SIEGE_EQUIPMENT_CONSTRUCTION;countof()for the archer point, support point, engineer queue and attack vector tables;TRUE/FALSEand truthiness;constlocals,+=, and"Mace_s4.wav"fromstring-literals.hpp;Header changes. None. Since 0701799, main declares both of the per-player arrays that
placeSiegeTentsAndAssignEngineersreads:AttackInfoDefinedData::field_0xc8[9], theMappersEnum[9]at 0x00B4C7CC. The PR's ownDAT_ARRAY_00b4c7cc.hppis removed.INT_ARRAY_00b4d0f0, the same header the PR had added.All headers and the address table are main's, including the
TribeStateenum below. The PR carries no header changes.The 5999 limits use main's new
SSS_UNUSABLE_THRESHOLD.After the 0701799 merge,
initializeOrAdvanceAttackWavedropped to 46.8%, because main's smallerAttackInfoDefinedDatachanges how the compiler assigns its registers. IncludingMap/Enums/TribeState.hppbrings it back to 100%; the PR comment explains this.TribeState enum:
Map/Enums/TribeState.hppandTribeStateShort.hppnow come from main (87e40b6), byte-identical to this PR's own enum commit:TS_UNUSED= 0,TS_ACTIVE= 2,TS_DISBANDED= 3.Tribe::tribeStatestays a plainshortin the generated header./GL entries (
cmake/compiler-flags-gl.txt) are the 13 the draft uses:collectArcherUnitsByLocationgetPlayerNot1AndHasKeepgetValueOfTroopTyperecountTotalTroopValueifNecessaryThrowOilAutomaticallyassignMacemenAndKnightsNotFromPlayer1ToTribesplaceSiegeTentsAndAssignEngineersscanForArcherPointsplaceTunnelForEveryTunnelergiveLightPitchInstructionToUnitClosestToPitchcomputeSiegeSpotScoresTribesState::addUnitToTribeTribesState::setWhetherTribeContainsAnyUnits: already on main; listed becauseaddUnitToTribecalls it.There are no function-visibility entries.
Overlap with open PRs:
reimpl/TroopValueState-100-batch-1) has 66 of these files. The GL list also differs from Reimplement 66 TroopValueState functions at 100% #501's.expandAIZoneLayerStage1/2/3, and the style pass here touched seven more:aiRecomputeAttacks2,collectArcherUnitsByLocation,executeDelayedAttackWaveTargetAssignment,findEnemyLord,recountTotalTroopValue,setRallyPointForLaddermenTribe,shouldLightPitchBasedOnTroopValue.addUnitToTribe,assignMacemenAndKnightsNotFromPlayer1ToTribes,getPlayerNot1AndHasKeep,placeSiegeTentsAndAssignEngineers.addUnitToTribe.addUnitToTribeassignBehaviorTypeAndLinkSupportTribeassignMacemenAndKnightsNotFromPlayer1ToTribescommandUnitsToMoveToKeepexitSiegeEquipmentForWavegiveLightPitchInstructionToUnitClosestToPitchifNecessaryThrowOilAutomaticallyinitializeOrAdvanceAttackWaveplaceSiegeTentsAndAssignEngineersplaceTunnelForEveryTunnelerscanForArcherPointsupdateInProgressAttackWaveCommits. First the header commit, then the GL commit, then one commit per function. Then come:
origin/main592a17d;status/addresses-SHC-3BB0A8C1.txt;TribeStateenum commit, thereview:commit, and the switch to theTS_prefix;origin/main0701799 and 06cdd81, and the adaptation to them (931d540 + 43b1738);origin/mainc1b50c4, 87e40b6 and 55fa231 (no adaptation needed), and the goto-freeassignBehaviorTypeAndLinkSupportTribe.The draft #275 stays open for the functions that are not finished. These do not qualify as register-only:
recountAttackTroopValue: the fill call moves across stores.assignBehaviorTypeToNearbyTribes: store order, a folded load, and an extraret.executeAttackWaveTargetAssignment:setgarithmetic instead of branches.placeSiegeTentOrTunnelAtSuitableLocationAndAssignEngineers: block layout.scanForSiegeTentPoints: frame size.recomputeAttackInfo: layout.sortAttackInfoTribeIDArrayBasedOn: 85.1% raw and 68.0% normalized on main's struct since 0701799 (it was 76.0%). Register allocation and the instruction count still differ.🤖 Generated with Claude Code
https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp