Repository navigation
Reimplement UpdateCamel, UpdateLady, UpdateMother and UpdateFireEater from gynt's units branch, under /GL (100%) - #515
Merged
Conversation
Units::UpdateCamel, from gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his draft PR 204; his 903b83a at 44.33%, "LTCG regs across calls", as our fork's copy of his branch has it), with main's header renames followed (43a17df, names only). There his draft measured 48.1% (normalised 48.1%) in a full build with the Globals and the function resolvers on (2026-11-10). A unit access goes through DAT_CurrentUnitSlotID where the original reads the slot global again, and through the cached unitID where it keeps the slot in a register (everything through unitID: quick_diff 1.0000 -> 0.8389). Some of those rereads follow a call (playSFXAtLocation, setUnitFacingDirectionTowardsTarget), others have none in front of them, such as the tribe read at the top; a one-line comment above unitID says so. In the resting state (US_UNKNOWN_205) the seated arm and the substate chain each test their own frame, as UpdateDrunkard does: the original merges the two identical tests, so its seated arm jumps past the frame reload the substate arms share (one test after both arms: quick_diff 1.0000 -> 0.9025). States 117, 120 and 205 are US_UNKNOWN_117, US_UNKNOWN_120 and US_UNKNOWN_205 (on main), and updateTickTracker (a short) takes the sum without a (short) cast. On main: no `(char)` casts on the fade countdown and the Frames_Shared_UnitClimbingUp tables (all char in main's headers), and `++` / `--` for the eight steps by one; the quick_diff listing is the same. Measured on main a841629 with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised): a narrow build of 351 files (main's /GL files, the unit texts recut in this round with their callee closures, every file of a function-visibility group that touches them), once with OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK both. It reads 100.0 / 100.0 with no diff entry in both modes; with the option on it is in the units' wrapper through main's UpdateCamel entry. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Units::UpdateLady, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his draft PR 204; his commits on the file: 8b5a376 at 53.73%, then 974c32f's clang-format), with this tree's field names (43a17df). It reads a true 100.0 / 100.0. The statements are his except the `random` local; what the text needed is how they are written. 1. Every access reads the unit through DAT_CurrentUnitSlotID::instance; the draft's local copy of the slot is gone (the original keeps the slot in edi and the unit pointer in esi from the global, 0x00543DCB). 2. The two tests of the random byte that choose the next outing (church or garden) compare with 1 and 3 (`<= 1`, `<= 3`) through an int local `random`, read behind the call in front of them: the original loads the byte with movzx and compares a signed int with the 1 it keeps in ebp (0x00543F57 .. 0x00543F63) and with 3 (0x00543FB8). The draft's `((byte)x & 7) < 2` / `< 4` compares bytes, and with that one use of 1 less the compiler gives the owner local ebp where the original keeps 1 there and the owner in a stack slot (0x00543DDC, 0x00543DEF). 3. Four compares in the original's form: `resourceToDeposit >= 8` (0x00544106), `movementRelated >= 8` (0x00544295), `resourceToDeposit < 2` (0x005443D1) and the fade countdown `>= 32` (0x00544603), where the draft had `> 7`, `> 7`, `<= 1` and `> 31`. 4. The chat walk tests setDestinationForUnit by truthiness with the success arm first, so that it is the fall-through (je at 0x00544196 to the failure arm). 5. The fade countdown without its `(char)` casts (a char in main's header); `x++` / `x--` for `x += 1` / `x -= 1`; `(UnitState)2`, `(UnitState)3` and `(UnitState)0x6c` and the two bare cachedState numbers as US_STATE_2Unk, US_STATE_3Unk and US_UNKNOWN_108; the BOOLEnum calls tested by truthiness; the hex constants in decimal; the include and the usings that nobody names any more dropped; const locals; one-line comments on the kept shapes. 6. The state blocks are one if / else-if chain whose arms fall out of it, ending in the default arm (IDLE, destination needed, stop walking), instead of separate blocks that return. The original's `resourceToDeposit >= 8` arm jumps forward to a later copy of the IDLE stores (jge at 0x0054410A to 0x005445A9); with the blocks returning, the compiler jumps back to an earlier copy instead. On main: the `(char)` casts on the four Frames_Shared_UnitClimbingUp tables and ANIM_Worker_Shared1 are gone too, since the tables are char in main's AnimationFrameData.hpp; the quick_diff listing is the same with and without them. Measured on main a841629 with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised): a narrow build of 351 files (main's /GL files, the unit texts recut in this round with their callee closures, every file of a function-visibility group that touches them), once with OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK both. With the option off it reads 100.0 / 100.0, no diff entry. With the option on it reads 96.5 / 93.2: main's UpdateLady entry gives its wrapper four callees, while under /GL it also sees updateBuildingSignpostCounter, commitUnitLocation, resetUnitMovementState and setUnitFacingDirectionTowardsTarget. The entry is not changed here. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Units::UpdateMother at 100%, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his draft PR 204; his commits on the file: b8b2363 at 44.76% and the style commit 2bf62f6 at 50.36%), through the forms on our development branches. Mostly the statements are his and what the text needed is how they are arranged; one test behaves differently from the draft (item 2). 1. `int owner = unit.owner;` at the top, used for the player data, the calls and the other mothers' owner in the look-around loop. The original keeps the player offset in ebp from the entry and owner in a stack slot (0x00546BDA), and the loop compares with that slot (cmp edx, [esp + 0x10] at 0x00547122). 2. The six "stay at home while enemies are around" tests as nested ifs with an early return in each arm: `if (mode != skirmish) { if (sumOfTotalEnemyUnitsCount != 0) {go home} } else if (someCount46 == 0) {go home}`, in front of the state's own code. A conditional expression or `&&` / `||` in the condition compiles to setcc, where the original branches (0x00546CD9 .. 0x00546CFF and five more). **In skirmish the original goes home when someCount46 == 0** (je to the go-home block at 0x00546CFF and 0x005471DB); five of the draft's six tests read someCount46 == 0 as "stay", only the FIRE state's had it this way. This changes the behaviour against the draft. 3. `distanceHigh <= 1` (cmp 1 / jg) and the roam state's end test as `checkType < 0 || checkType > 0` (jl / jle at 0x00547645). 4. The fade countdown without its `(char)` casts: the field is a char in main's header. On main: the `(char)` casts on the two Frames_Shared_UnitClimbingUp tables are gone too, since the tables are char in main's AnimationFrameData.hpp; the quick_diff listing is the same with and without them. Measured on main a841629 with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised): a narrow build of 351 files (main's /GL files, the unit texts recut in this round with their callee closures, every file of a function-visibility group that touches them), once with OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK both. With the option off it reads 100.0 / 100.0, no diff entry. With the option on it reads 52.9 / 49.4: it has no entry, and in that mode the wrapped callees leave the /GL list (main's UpdatePriest reads 72.0 there in the same build). Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Units::UpdateFireEater, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his draft PR 204; his commits on the file: 8e14523 at 35.71%, then 974c32f's include order and clang-format), with this tree's field names (43a17df). It reads a true 100.0 / 100.0. The statements are his; what the text needed is how they are arranged and named. 1. Every access reads the unit through DAT_CurrentUnitSlotID::instance; the draft's local copy of the slot is gone (the original keeps the unit pointer in esi from the global, 0x00549659). 2. The owner is read once into an int local for both PlayerData uses: the original computes its offset once (0x00549668) and uses it for the citizen count (0x00549673) and for areCarnivalUnitsPresent (0x00549694). 3. The state blocks are one if / else-if chain whose arms fall out of it, instead of separate `if (state == X) { ...; return; }` blocks. 4. States 2 and 3 write their `frame <= 0` arm as an if / else that falls out of the chain; the reload state keeps its `return;`. The original keeps the reload state's copy of that tail (0x005499B5) and jumps there from states 2 and 3 (jle at 0x0054994F and 0x00549983); their gfx sums join at 0x005499D2. With the arms returning, the compiler keeps the earlier copy instead. 5. The fade countdown without its `(char)` cast (a char in main's header); `x++` for `x += 1` (six places); `(UnitState)120`, `(UnitState)2` and `(UnitState)3` as US_UNKNOWN_120, US_STATE_2Unk and US_STATE_3Unk; the three BOOLEnum calls tested by truthiness; the hex constants in decimal; the usings and includes that nobody names any more dropped; one-line comments on the kept shapes and on the 2000-update lifetime; const locals. On main: the `(char)` casts on the five Frames_Shared_UnitClimbingUp tables are gone too, since the tables are char in main's AnimationFrameData.hpp; the quick_diff listing is the same with and without them. Measured on main a841629 with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised): a narrow build of 351 files (main's /GL files, the unit texts recut in this round with their callee closures, every file of a function-visibility group that touches them), once with OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK both. It reads 100.0 / 100.0 with no diff entry in both modes; with the option on it is in the units' wrapper through main's UpdateFireEater entry. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gynt
approved these changes
Nov 29, 2026
This was referenced Nov 29, 2026
kotijekriv
added a commit
to kotijekriv/OpenSHC
that referenced
this pull request
Nov 30, 2026
…d#515, sourcehold#516 and sourcehold#518 (sourcehold#534) sourcehold#515, sourcehold#516 and sourcehold#518 put twelve units on cmake/compiler-flags-gl.txt. UpdateCamel, UpdateLady and UpdateFireEater have an entry here already and read 100.0% with OPENSHC_FUNCTION_VISIBILITY_UNITS on; the other nine have none. In that mode the members of every group leave the /GL list, among them the helpers in the group that holds hasUnitReachedDestination, so a /GL unit without an entry no longer sees them: the nine read 37.7% to 65.7% in main ff7e56e's full build in that mode, the build the real builds below compare against. Each gets an entry at its address, its callees in address order. The /GL lines stay as they are. Each entry names only callees that are already members of the group that holds hasUnitReachedDestination, so the nine join that group and nothing else moves: no other function leaves the /GL list, and no other function sees a body it did not see before. The nine's other /GL callees (setDestinationForUnit, moveToFreeTileNearby, acquireShootTarget, shootProjectile and the rest of their closures) stay opaque to them, and they read 100.0% / 100.0% that way (raw / normalised: reccmp_report.py's normalised figure ignores call and tail-jump targets and resolver addresses). Naming each unit's whole /GL callee closure instead would put 28 more functions in that group: with every .cpp of main as the build list, cmake/function-visibility-units.py then makes 22 wrapper units holding 178 source files, against 25 holding 141 on main (the nine units and 28 of their callees join, and three smaller groups merge in). Those 28 would leave the /GL list for main's callers that have no entry (processUnitMove, exitLadder, unitClimbing, UpdateHorseArcher_DoShooting and others). Each caller-callee pair is measured as sourcehold#491's were: the unit's file compiled with the callee files pasted in front of it, against the unit alone, quick_diff on main ff7e56e. The data resolvers were switched on with tools/reimplementation-control/enable_reimplemented_data.py and the function resolver of every .cpp in the build list with tools/reimplementation-helper/batch/enable_local_functions.py (locally, not committed). The callees tried are the group's members that the unit calls directly or through another member it calls (so indirect ones too: commitUnitLocation's two callees for UpdateTunneler, ConsiderHavingABreakNowUnk behind UpdateWorker_ConsiderTakingABreakUnk for UpdateWheatFarmer), not callees reached only through functions outside the group. A callee is listed when leaving it out of that set lowers the ratio; the listed set reads what the whole set reads. quick_diff is stricter than reccmp about register names; the real builds read each unit at 100.0%. - UpdateMother: 0.5668 alone, 0.9918 with its 3. Left out, checkIfCitizenUnitIsAliveBasedOnState reads 0.7900, hasUnitReachedDestination 0.8918, changeDestinationByAmount 0.8994. - UpdateChild: 0.5564 alone, 0.9993 with its 4. Left out, checkIfCitizenUnitIsAliveBasedOnState reads 0.8294, hasUnitReachedDestination 0.9153, hasTunnelerNotFinishedDigging 0.9881, changeDestinationByAmount 0.9976. - UpdateTunneler: 0.6433 alone, 0.9897 with its 2. Left out, checkIfCitizenUnitIsAliveBasedOnState reads 0.7619, hasUnitReachedDestination 0.6726. commitUnitLocation and its callees setupUnitSharingCurrentTilePosition and setupUnitSharingTileIDs change nothing. - UpdateWheatFarmer: 0.4115 alone, 0.9988 with its 8. Left out, IncrementAndOptionalUpdateAVValueRelated reads 0.7775, ConsiderHavingABreakNowUnk 0.9838, SetStateToFreetimeWalking 0.9898, ComputeGoodsProduced 0.9784, checkIfCitizenUnitIsAliveBasedOnState 0.8193, hasUnitReachedDestination 0.9462, changeDestinationByAmount 0.9130, UpdateWorker_ConsiderTakingABreakUnk 0.9838. - UpdateCrusaderArcher: 0.6723 alone, 0.9869 with its 3. Left out, xyAreValid reads 0.9709, hasUnitReachedDestination 0.7176, changeDestinationByAmount 0.9853. - UpdateCrossbowman: 0.6537 alone, 0.9964 with hasUnitReachedDestination. - UpdateLadderman: 0.4106 alone, 0.9938 with hasUnitReachedDestination. - UpdateArabianArcher: 0.5843 alone, 0.9944 with hasUnitReachedDestination. - UpdateFireThrower: 0.6844 alone, 0.9965 with hasUnitReachedDestination. makeUnitStopWalkingByClearingPathProgressState, which UpdateMother, UpdateChild and UpdateWheatFarmer call, changes nothing for any of them. With every .cpp of main as the build list, cmake/function-visibility-units.py now makes 25 wrapper units holding 150 source files (141 before): the nine join the group that holds hasUnitReachedDestination, and no other file changes group. CMake reads this file only with the option on, so the default build is unchanged. Real builds of this change on main ff7e56e, BUILD_OK and 0 failures each: - full, option on: every .cpp of main with all function and data resolvers on (the 12 files that don't compile since sourcehold#509's sync left out), 3,025 files and 3,043 functions, against main ff7e56e built the same way. The nine read 100.0% / 100.0% (main: 37.7% to 65.7%); nothing else reads differently. - small, both modes: main's /GL list, every .cpp that reads Unit::disappearFadeAlphaCountdown, the twelve units and UpdatePriest with their callee closures, and every file of a group that touches them, 485 files and 495 functions. All twelve read 100.0% / 100.0% in both modes; UpdatePriest, which has no entry, 100.0% off and 72.0% / 68.9% on, as on main. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Dec 1, 2026
kotijekriv
added a commit
to kotijekriv/OpenSHC
that referenced
this pull request
Dec 1, 2026
…er and UpdateSlave from gynt's units branch (100%, three with OPENSHC_FUNCTION_VISIBILITY_UNITS on) (sourcehold#537) * reimplement: SHC_3BB0A8C1_0x0053C300 100.0% Reimplemented Units::UpdateShield at 100%, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his commits on the file: f791380 at 49.29%, cf15f54 at 52.39%, 6565c1b, 8ca7861 (the file again, whole) and the style commit 974c32f), through the forms on our development branches, where its history is (94.0% there, on main 1f87a13). What the match needed, against the draft: - The state it starts in is picked by an if / return pair, as in main's UpdateBatteringRam (sub / neg / sbb / and at 0x0053C382); the draft had a ternary. - Every access reads the unit through DAT_CurrentUnitSlotID::instance; the draft's local copy `int unitID` is gone. - The scan for engineers tests its six conditions as six `if (...) { continue; }` statements, the counts are cleared with memset, the distances compare with the engineer first, and the tests read `> 16` and `< 1`, as the original compares. The tick test reads `^ 8` where the draft had `^ 0xfffffff8`, the same value under `& 15`. - The AI check's loop and the two blocks that send the engineer to work are loops of one over manningEngineerRef and engineerIDs[9][1]: the first is a loop in the original too (0x0053C4C3), the others make it compute the unit's offset anew (0x0053C4D9, 0x0053C744), the start of a loop the compiler unrolled. Written out with index 0 (the first as a do / while (0), as its tests break out of it), they read 0.7650, 0.9848 and 0.9913 in quick_diff, against 0.9978. - The search for the capturing owner is a for loop from 1 to 8 with a found flag, the source form that matches (the binary has no flag: the loop at 0x0053C6A7 returns at its end, 0x0053C6B4), and, the last step, it has a local of its own that is copied behind the capture, as in main's UpdateBatteringRam, where the parked text searched in the local that holds the shield's owner. With it the scan's bound stays in ebx (loaded at 0x0053C57F, compared at 0x0053C682): 0.9859 -> 0.9978 in quick_diff with the /GL callees in the unit (the one line left, 0xffff against -0x1, is the same instruction). The bound read as the global itself instead of through a local came first (0.9827 -> 0.9859). - createTribe gets the owner of units[searched], where searched is the counter the scan left behind (0x0053C70F); the draft passed the shield's own owner. The same call is in main's UpdateBatteringRam, and so is the next one: addUnitToTribe gets the tribe as unitID and the shield as tribeID (0x0053C736), with a fixme for each. compiler-flags-gl.txt gets UpdateShield.cpp only: the two callees it has to see are on main's list already (quick_diff 0.5457 without hasUnitReachedDestination, 0.8707 without deselectUnit, 0.5152 without both). On main, this round's text pass: main's name for state 108, BOOLEnum calls by truthiness, `++`, `const` on locals, the fade countdown without its cast, UpdateBatteringRam's names and comments for the scan and its if / return pair for the first state. The quick_diff listing is the same before and after it. Measured with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised), on main 830fbd5: the small build of this branch's head (503 files, 513 functions: every /GL file of main, every .cpp that reads Unit::disappearFadeAlphaCountdown, the five units, the fourteen of sourcehold#515, sourcehold#516, sourcehold#518 and sourcehold#533 and UpdatePriest with their callee closures (UpdateSlave's without playVictory2BikFromPlayerToPlayer's, which doesn't link in a small build), two callers of standUpIfSeated and every file of a function-visibility group that touches them), once with OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK both. The full builds (3,041 files, 3,059 functions: every .cpp but main's three that don't compile, once off and once on) were made before the last text edits; quick_diff gives the same listing of every file before and after them. It reads 100.0 / 100.0 in all of them. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * reimplement: SHC_3BB0A8C1_0x0054F860 96.3% 100.0 with OPENSHC_FUNCTION_VISIBILITY_UNITS on Units::UpdateHunter, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his commits on the file: 76bb533 at 48.51%, 9f9546f at 52.15%, 8ca7861 (the file again, whole) and the style commit 974c32f), through the forms on our development branches, where its history is (95.3% there). 100% with OPENSHC_FUNCTION_VISIBILITY_UNITS on, with its entry in this branch's last commit; 96.3% in the default build, so the status line carries that number, as UpdatePitchman's does. What the match needed, against the draft: - Every access reads the unit through DAT_CurrentUnitSlotID::instance; the draft's local copy `int unitID` is gone. - The states are one if / else-if chain whose arms fall out of it, where the draft had a block per state that returns; the shooting state keeps its closing return. - The shooting state has the "look for another deer, or go home" block once in the arrow part, behind a flag the arrow sets, and once behind it (0x0054FF45, 0x0054FF71). The draft had it twice in the arrow part. The flag, arrowFired, is the source form that matches: the binary has none, four tests jump to 0x0054FF45. - The early exits go the original's way round: the other hunter's uid test, "the deer is gone" and "the deer is within 20" first when chasing, the walk to the post with the failed setDestinationForUnit as the else arm. - The substate set when the hunter gets back to his post is (mapTimeInTicks & 1) + 2 with no cast (0x00550529), and the two height sums of the shot have the terrain height first. What the option is for: the original knows ten of its callees and treats two, updateBuildingSignpostCounter and getResourceCountThatCanBeDeposited, as opaque (it reads the slot again behind them). Both are on main's /GL list, so the default build sees their bodies: quick_diff reads 0.9857 with all /GL callees in the unit, 0.9991 with the ten only, where the one line left, 0xff against -0x1, is the same instruction. With the option on the two are in other wrapper units. compiler-flags-gl.txt gets UpdateHunter.cpp, as it has UpdatePitchman.cpp. On main, this round's text pass: main's names (UnitState_Hunter) for the hunter's states 0 to 11 and 106, through state.hunter (as main's UpdatePitchman and UpdateWheatFarmer do for theirs), and for the resting state (USH_RESTING_7); 108 to 111, 113 and 121 keep the shared US_ names; DNE_UNKNOWN_2 and RT_MEAT; BOOLEnum calls by truthiness, `++` / `--`, `const` on locals, the fade step stored as -2, no `(char)` on the frame tables and the fade countdown, unused `using` lines dropped, and the local for the slot in front of commitUnitLocation dropped. The quick_diff listing is the same before and after it. Measured with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised), on main 830fbd5: the small build of this branch's head (503 files, 513 functions: every /GL file of main, every .cpp that reads Unit::disappearFadeAlphaCountdown, the five units, the fourteen of sourcehold#515, sourcehold#516, sourcehold#518 and sourcehold#533 and UpdatePriest with their callee closures (UpdateSlave's without playVictory2BikFromPlayerToPlayer's, which doesn't link in a small build), two callers of standUpIfSeated and every file of a function-visibility group that touches them), once with OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK both. The full builds (3,041 files, 3,059 functions: every .cpp but main's three that don't compile, once off and once on) were made before the last text edits; quick_diff gives the same listing of every file before and after them. With the option on it reads 100.0 / 100.0, with it off 96.3 / 86.9. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * reimplement: SHC_3BB0A8C1_0x00553AE0 94.6% 100.0 with OPENSHC_FUNCTION_VISIBILITY_UNITS on Units::UpdateAppleFarmer, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his commits on the file: 69e0814 at 43.32%, 8ca7861 (the file again, whole) and the style commit 974c32f), through the forms on our development branches, where its history is (94.1% there). 100% with OPENSHC_FUNCTION_VISIBILITY_UNITS on, with its entry as this branch's last commit leaves it; 94.6% in the default build, so the status line carries that number, as UpdatePitchman's does. What the match needed, against the draft: - The branches of four states the original's way round, read off it one basic block at a time: going to the workplace and waiting for a tree (the call that works first), the granary walk (its failure path written out), the deposit (one local for getResourceCountThatCanBeDeposited's result). - The last steps: every access reads the unit through DAT_CurrentUnitSlotID::instance (our parked text still indexed some through the draft's `unitID` and one state through a local for the slot, across a setDestinationForUnit call, which is not a named callee and stays opaque), and the waiting state stores the slot into the orchard's workers[] before it reads the frame, as main's UpdateDairyFarmer does. In quick_diff with the group's callees in the unit 0.9899 -> 0.9984 (the one line left, 0xff against -0x1, is the same instruction). Only together: 0.9844 without the second step, 0.9891 with the state's local kept. What the option is for: the original reads the slot again behind getResourceCountThatCanBeDeposited, which is on main's /GL list, so the default build sees its body and keeps the register (quick_diff 0.9820 with it, 0.9984 without). compiler-flags-gl.txt gets UpdateAppleFarmer.cpp, as it has UpdatePitchman.cpp. On main, this round's text pass: main's names for states 108 and 121 and for DNE_UNKNOWN_2, BOOLEnum calls by truthiness, `++` / `--`, `const` on locals, no `(char)` on the frame tables and the fade countdown, the unused `using` lines and one unused include dropped, USAF_WAITING_1 for the resting state and the farmer's own state type for the local. The quick_diff listing is the same before and after it. Measured with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised), on main 830fbd5: the small build of this branch's head (503 files, 513 functions: every /GL file of main, every .cpp that reads Unit::disappearFadeAlphaCountdown, the five units, the fourteen of sourcehold#515, sourcehold#516, sourcehold#518 and sourcehold#533 and UpdatePriest with their callee closures (UpdateSlave's without playVictory2BikFromPlayerToPlayer's, which doesn't link in a small build), two callers of standUpIfSeated and every file of a function-visibility group that touches them), once with OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK both. The full builds (3,041 files, 3,059 functions: every .cpp but main's three that don't compile, once off and once on) were made before the last text edits; quick_diff gives the same listing of every file before and after them. With the option on it reads 100.0 / 100.0, with it off 94.6 / 89.6. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * reimplement: SHC_3BB0A8C1_0x0056E190 100.0% Reimplemented Units::UpdateJester at 100%, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his commits on the file: 146023d at 42.00%, 93b5ce0 at 50.14%, 8ca7861 (the file again, whole) and the style commit 974c32f), through the forms on our development branches, where its history is (94.1% there). What the match needed, against the draft: - Every access reads the unit through DAT_CurrentUnitSlotID::instance; the draft's local copy `int unitID` is gone. - The states are one if / else-if chain whose arms fall out of it, where the draft had a block per state that returns, and the first death state tests "the animation is over" first. - gfxBase is declared at the function's top (with a comment): the original zeroes a register for it in the first block and keeps the owner in the frame (0x0056E1C7). - The random roll is read once into an int local and compared twice (0x0056E336). The text stores the wandering state in two arms; the original has the store once (0x0056E3AF) and so has ours, the compiler merges the two arms (one arm for both cases loses the match: quick_diff 0.9950 and 0.9894 against 0.9986). - The last steps, on this main: two locals our parked text had for the slot are gone, one around changeDestinationByAmount in the walk-up state and one in front of commitUnitLocation in the fade state. With the callees' bodies visible they cost (quick_diff with the /GL callees in the unit 0.9612 -> 0.9936 -> 0.9958). And the walk-up state tests `movementSpeed < 1`, a compare with the constant 1 the original holds in bp, where the draft had `<= 0`, the same values (0.9958 -> 0.9986; the one line left, 0xff against -0x1, is the same instruction). compiler-flags-gl.txt gets UpdateJester.cpp only: the eight callees it has to see are on main's list already (quick_diff without each: checkIfCitizenUnitIsAliveBasedOnState 0.8217, changeDestinationByAmount 0.8870, hasUnitReachedDestination 0.9627, makeUnitStopWalkingByClearingPathProgressState 0.9859, hasTunnelerNotFinishedDigging 0.9944, commitUnitLocation, setupUnitSharingCurrentTilePosition and setupUnitSharingTileIDs 0.9958 each; 0.5465 without any). On main, this round's text pass: main's names for states 2, 3 and 108, BOOLEnum calls by truthiness, `++` / `--`, `const` on locals, decimal constants, the fade step stored as -2, no `(char)` on the frame tables and the fade countdown and no `(byte)` on the random number, unused `using` lines and one unused include dropped. The quick_diff listing is the same before and after it. Measured with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised), on main 830fbd5: the small build of this branch's head (503 files, 513 functions: every /GL file of main, every .cpp that reads Unit::disappearFadeAlphaCountdown, the five units, the fourteen of sourcehold#515, sourcehold#516, sourcehold#518 and sourcehold#533 and UpdatePriest with their callee closures (UpdateSlave's without playVictory2BikFromPlayerToPlayer's, which doesn't link in a small build), two callers of standUpIfSeated and every file of a function-visibility group that touches them), once with OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK both. The full builds (3,041 files, 3,059 functions: every .cpp but main's three that don't compile, once off and once on) were made before the last text edits; quick_diff gives the same listing of every file before and after them. It reads 100.0 / 100.0 in all of them. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * reimplement: SHC_3BB0A8C1_0x00571C00 91.7% 100.0 with OPENSHC_FUNCTION_VISIBILITY_UNITS on Units::UpdateSlave, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his commits on the file: 1f2f3bf at 43.44%, cfa098f at 49.88%, 6565c1b, 8ca7861 (the file again, whole) and the style commit 974c32f), through the forms on our development branches, where its history is (87.4% there). 100% with OPENSHC_FUNCTION_VISIBILITY_UNITS on, with its entry as this branch's last commit leaves it; 91.7% in the default build, so the status line carries that number, as UpdatePitchman's does. What the match needed, against the draft: - Every access reads the unit through DAT_CurrentUnitSlotID::instance; the draft's local copy `int unitID` is gone. - The fill-moat branch counts the moat's countdown down first, then sets the targeting type, on every path (in the source, the path where setXYBasedOnMoatID returns 0 has the two the other way round, as main's UpdateEngineer does; the other order loses the match, quick_diff 0.9710 against 0.9792). The moving state tests "delay running" first; its moat branch and the digging walk go the original's way round. - The last steps, on this main (quick_diff with the group's callees in the unit, each on the one before): - the parked text's local for the slot across changeDestinationByAmount is gone, the dig state's two frame arms are the other way round, and the unit on the dig tile is read once into a local, as in main's UpdatePikeman (0.9555 -> 0.9654); - state 0 ends in a chain of three arms whose last two store the same state, as in main's UpdateEngineer: the original branches on 400 only (0x00571EFD), a two-way if / else and an early return for the 400 arm become a setcc instead (0.9683), and 0.9654 -> 0.9764 for the chain on the earlier text. The 96 of the middle arm is UpdateEngineer's number, by analogy; the original has no 96 here. - the moat's owner is read through a local for returnOwnedMoatAtTile's result (0.9764 -> 0.9792). What is left of the 0.9792 is how quick_diff spells constants, two-global sums and the timeGetTime import. - `(int)` on the tick sum in front of `% 40`: the original divides signed (cdq, idiv), as in main's UpdatePikeman; the draft's remainder is unsigned, which differs once the sum passes 2^31. What the option is for: getBuildingFlammabilityFactor is on main's /GL list, so the default build sees its body, and the original treats it as opaque (quick_diff 0.9284 with it, 0.9792 without). compiler-flags-gl.txt gets UpdateSlave.cpp, as it has UpdatePitchman.cpp. On main, this round's text pass: main's names for states 2, 104, 105, 108 and 124 and for CD_UNSPECIFIED and L_MOAT, BOOLEnum calls by truthiness, `++` / `--`, `const` on locals, no `(char)` on the frame tables and the fade countdown and no `(short)` where main's UpdatePikeman has none, the string's text above its pointer, one unused include dropped, CD_SOUTH for the rally's facing, an else-if and one else less around the two returns. The quick_diff listing is the same before and after it. The compares with -1 (0.9693 with >= 0), the two closing stores of the dig state written on both paths (0.9622 when written once), and the US_APPEAR stores of the sheet offset and the speed in both arms (0.9759 to 0.9782 hoisted) are measured, with comments in the text. Measured with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised), on main 830fbd5: the small build of this branch's head (503 files, 513 functions: every /GL file of main, every .cpp that reads Unit::disappearFadeAlphaCountdown, the five units, the fourteen of sourcehold#515, sourcehold#516, sourcehold#518 and sourcehold#533 and UpdatePriest with their callee closures (UpdateSlave's without playVictory2BikFromPlayerToPlayer's, which doesn't link in a small build), two callers of standUpIfSeated and every file of a function-visibility group that touches them), once with OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK both. The full builds (3,041 files, 3,059 functions: every .cpp but main's three that don't compile, once off and once on) were made before the last text edits; quick_diff gives the same listing of every file before and after them. With the option on it reads 100.0 / 100.0, with it off 91.7 / 66.3. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * cmake: function-visibility.txt entries for UpdateShield, UpdateHunter, UpdateAppleFarmer, UpdateJester and UpdateSlave New entries for UpdateShield, UpdateHunter and UpdateJester; UpdateAppleFarmer's and UpdateSlave's, which main had before the files existed, each name two more callees. All name only callees that are already members of the group that holds hasUnitReachedDestination, so the five units join that group's wrapper unit and nothing else moves: no other function sees a body it didn't see before or loses one. Each caller-callee pair is measured as sourcehold#491's were (quick_diff, the unit's file with the callee files pasted in front of it, against the unit alone). The callees tried are the group's members that the unit calls directly or through another member it calls; one is named when leaving it out lowers the ratio, and the named set reads what the whole set reads: - UpdateShield 0.5152 alone, 0.9978 with its two: without hasUnitReachedDestination 0.5457, deselectUnit 0.8707. - UpdateHunter 0.4887 alone, 0.9991 with its ten: without IncrementAndOptionalUpdateAVValueRelated 0.6953, checkIfCitizenUnitIsAliveBasedOnState 0.9004, hasUnitReachedDestination 0.9201, ComputeGoodsProduced 0.9840, SetStateToFreetimeWalking 0.9880, UpdateWorker_ConsiderTakingABreakUnk and ConsiderHavingABreakNowUnk 0.9907 each, commitUnitLocation, setupUnitSharingCurrentTilePosition and setupUnitSharingTileIDs 0.9929 each. Not named: makeUnitStopWalkingByClearingPathProgressState (no change). - UpdateAppleFarmer 0.5793 alone, 0.9984 with its seven: without checkIfCitizenUnitIsAliveBasedOnState 0.8558, IncrementAndOptionalUpdateAVValueRelated 0.8580, ComputeGoodsProduced 0.8918, hasUnitReachedDestination 0.9408, SetStateToFreetimeWalking 0.9891; new in the entry, UpdateWorker_ConsiderTakingABreakUnk and ConsiderHavingABreakNowUnk, 0.9713 each. Not named: makeUnitStopWalkingByClearingPathProgressState (no change). - UpdateJester 0.5465 alone, 0.9986 with its eight: the numbers are in its commit. - UpdateSlave 0.5410 alone, 0.9792 with its three: without hasUnitReachedDestination 0.5245; new in the entry, xyAreValid 0.9173 and changeDestinationByAmount 0.9764. On top of the named callees, each /GL callee outside the group that the unit calls was tried one at a time, without its own callees: only updateBuildingSignpostCounter (UpdateHunter 0.9933), getResourceCountThatCanBeDeposited (UpdateHunter 0.9915, UpdateAppleFarmer 0.9820) and getBuildingFlammabilityFactor (UpdateSlave 0.9284) change a ratio, and all lower it. Full build of every file with the option on (3,041 files, 3,059 functions, BUILD_OK, 0 failures), against main 830fbd5's tree built the same way (3,036 files, 3,054 functions): nothing on main reads differently, and the five units read 100.0 / 100.0. It was made before the last text edits of the five units; quick_diff gives the same listing of every file before and after them. The generator makes 25 wrapper units holding 160 source files (155 on main): the five units join the group that holds hasUnitReachedDestination, and no other file changes group. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
gynt
pushed a commit
to gynt/OpenSHC
that referenced
this pull request
Dec 2, 2026
…t and UpdateMiller (sourcehold#535) sourcehold#534 gave the nine /GL units of sourcehold#515, sourcehold#516 and sourcehold#518 that had no entry in cmake/function-visibility.txt one, and left three for a follow-up: UpdatePeasant and UpdateMiller (sourcehold#533), and UpdatePriest, main's own unit. This adds the three, each at its address, its callees in address order. All three are on cmake/compiler-flags-gl.txt already (UpdatePriest was there before those PRs); that file stays as it is. With OPENSHC_FUNCTION_VISIBILITY_UNITS on, the members of every group leave the /GL list, among them the helpers in the group that holds hasUnitReachedDestination, so a /GL unit without an entry no longer sees them: in main e62246a's full build in that mode, the build the real builds below compare against, UpdatePriest reads 72.0% / 68.9%, UpdatePeasant 49.3% / 48.7% and UpdateMiller 51.7% / 46.2% (raw / normalised: reccmp_report.py's normalised figure ignores call and tail-jump targets and resolver addresses). UpdatePriest's entry names only callees that are already members of the group that holds hasUnitReachedDestination, as sourcehold#534's do. UpdatePeasant's and UpdateMiller's name members of that group and, each, one more /GL callee that is not in it: getDestination2EqualsGivenCoordinates for UpdatePeasant and standUpIfSeated for UpdateMiller. With the members alone they read 96.0% / 87.1% and 96.5% / 93.0% in an earlier full build of this branch with the option on (below). With that callee they read 100.0%, so it joins the group, and with the option on, CMake takes five more files off the /GL list: the three units, getDestination2EqualsGivenCoordinates and standUpIfSeated. Nothing else moves: getDestination2EqualsGivenCoordinates is called by UpdatePeasant only, and standUpIfSeated by UpdateMiller, standUpAllTribeUnits and updatePeasantSeatingAtBuilding (neither of the last two is on the /GL list or has an entry, so neither saw its body before or sees it now). No other function sees a body it did not see before. The three units' other /GL callees (setDestinationForUnit, resetUnitMovementState, clearHiddenFlagAndUpdatePosition, setWorkplaceBuildingEntryAsTarget, selectNewBlessingTarget, setUnitFacingDirectionTowardsTarget and the rest of their closures) stay opaque to them. Each caller-callee pair is measured as sourcehold#491's and sourcehold#534's were: the unit's file compiled with the callee files pasted in front of it, against the unit alone, quick_diff on main e62246a, with the data resolvers switched on by tools/reimplementation-control/enable_reimplemented_data.py and the function resolver of every .cpp in the build list by tools/reimplementation-helper/batch/enable_local_functions.py (locally, not committed). The callees tried are the group's members that the unit calls directly or through another member it calls (commitUnitLocation's callee setupUnitSharingCurrentTilePosition and, behind it, setupUnitSharingTileIDs, included), not callees reached only through functions outside the group; and, for UpdatePeasant and UpdateMiller, each /GL callee outside the group that they call, one at a time on top of the named members, pasted without its own callees unless it says "with its callees". A callee is listed when leaving it out of the set lowers the ratio; the listed set reads what the whole set reads. quick_diff is stricter than reccmp about register names; the real builds read the units at 100.0%. - UpdatePriest: 0.7534 alone, 0.9986 with its 5. Left out, makeUnitStopWalkingByClearingPathProgressState reads 0.9891, IncrementAndOptionalUpdateAVValueRelated 0.8859, checkIfCitizenUnitIsAliveBasedOnState 0.9510, hasUnitReachedDestination 0.9680, changeDestinationByAmount 0.9850. commitUnitLocation, its callee setupUnitSharingCurrentTilePosition and, behind it, setupUnitSharingTileIDs change nothing. - UpdatePeasant: 0.5329 alone, 0.9941 with its 3. Left out, checkIfCitizenUnitIsAliveBasedOnState reads 0.5880, getDestination2EqualsGivenCoordinates 0.9725, hasUnitReachedDestination 0.9684. Outside the group, on top of the two members, clearHiddenFlagAndUpdatePosition (with its callees) and setDestinationForUnit change nothing. - UpdateMiller: 0.5531 alone, 0.9973 with its 13. Left out, getBuildingResourceAmountByUid reads 0.9722, setupUnitSharingTileIDs 0.9947, standUpIfSeated 0.9913, sitDownIfStanding 0.9953, IncrementAndOptionalUpdateAVValueRelated 0.8442, ConsiderHavingABreakNowUnk 0.9914, SetStateToFreetimeWalking 0.9707, ComputeGoodsProduced 0.9661, checkIfCitizenUnitIsAliveBasedOnState 0.8008, hasUnitReachedDestination 0.9593, setupUnitSharingCurrentTilePosition 0.9947, UpdateWorker_ConsiderTakingABreakUnk 0.9914, commitUnitLocation 0.9947. makeUnitStopWalkingByClearingPathProgressState changes nothing. Outside the group, on top of the twelve members, resetUnitMovementState (with its callees), setDestinationForUnit, setWorkplaceBuildingEntryAsTarget, addResourceToStockpile, buildingIsAccessible, updateBuildingSignpostCounter and getStorageBuildingForResourceTypeAndAmount change nothing; the last four are members of other groups, so with the option on they are off the /GL list already, and naming one would merge two groups. With every .cpp of main as the build list, cmake/function-visibility-units.py makes 25 wrapper units holding 155 source files (150 before): the three units and the two callees join the group that holds hasUnitReachedDestination, and no other file changes group. CMake reads this file only with the option on, so the default build is unchanged. Real builds on main e62246a, BUILD_OK and 0 failures each: - full, option on: every .cpp of main with all function and data resolvers on (the 3 files that don't compile there left out: findBestAttackTileByPathCost, resetTileAndClearMoat, TransformAndRenderPercentage), 3,036 files and 3,054 functions, against main e62246a built the same way. Two full builds of the branch's side: one with the three entries without getDestination2EqualsGivenCoordinates and standUpIfSeated (UpdatePriest's as it is now), which reads UpdatePeasant 96.0% / 87.1%, UpdateMiller 96.5% / 93.0% and UpdatePriest 100.0% / 100.0%; and this change, which reads the three 100.0% / 100.0%. Against main nothing else reads differently in either. - small, both modes: main's /GL list, every .cpp that reads Unit::disappearFadeAlphaCountdown, the twelve units of sourcehold#515, sourcehold#516 and sourcehold#518 (nine in sourcehold#534, three with an entry before it) and these three with their callee closures, standUpAllTribeUnits and updatePeasantSeatingAtBuilding, and every file of a group that touches them, 494 files and 504 functions. All fifteen units read 100.0% / 100.0% in both modes. UpdateFireBallistaBuilding: with the option off, where this file is not read, 100.0% / 100.0% with the 494 files and 99.6% / 95.5% with 492 (without standUpAllTribeUnits and updatePeasantSeatingAtBuilding), so its reading changes with the set of files built; with the option on, 99.6% / 95.5% with the 494 files, and main was not built with those files and the option on, so that case is not settled. It reads 100.0% / 100.0% in both full builds, this change's and main's. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Four more Map::Units update functions, from gynt's units branch
reimpl/map-units-updatefunctions(his draft #204). We had them at 100% on #378's branch before it merged; these are the same statements on main, which now has #378's UnitsState callees (the two passes below changed only casts,++/--,const, comments, one include and one loop variable's name). Each reads 100.0% in the default build with its own line incmake/compiler-flags-gl.txt. Each commit cites gynt's commits on the file and our steps on it, and credits him as co-author. No header change and no change tocmake/function-visibility.txt: main already has entries for UpdateCamel, UpdateLady and UpdateFireEater.Units::UpdateCamel/GL; 100.0% withOPENSHC_FUNCTION_VISIBILITY_UNITSonUnits::UpdateLady/GL; 96.5% with the option onUnits::UpdateMother/GL; 50.1% with the option onUnits::UpdateFireEater/GL; 100.0% with the option onMeasured.
Stronghold Crusader.exe(3bb0a8c1…5387ac5a), both resolver sets enabled locally (not committed), and sourcehold's reccmp (a86aceb03) with--resolve-wrapped-calls --ignore-security-cookie..cppof this branch (main a841629 plus the four files), all function and data resolvers on, built once with the option off and once with it on, 0 failures, 2,955 functions each. Against builds of main a841629 made the same way (2,951 functions):UI::Menu::Constructor_Menu(98.4% to 100%) andhandleMenuItems(97.9% to 100%): reccmp names the constants 0x11000000 and 0x21000000 after whatever of ours lands at that address, so they flip with the image layout, as in Reimplement UpdateDairyFarmer from gynt's units branch (100% with OPENSHC_FUNCTION_VISIBILITY_UNITS on) #513's builds./GLlines (and, in the same tree, eleven more unit texts we are still working on), the callees of all of them, every/GLfile of main and every file of a function-visibility group that touches them: 351 files, 361 functions, 0 failures in both modes. All four read 100.0% / 100.0% (normalised) with the option off. With it on, UpdateCamel and UpdateFireEater read 100.0% / 100.0%, UpdateLady 96.5% / 93.2% and UpdateMother 52.9% / 49.4% (below).(char)casts on the animation frame tables and on the fade countdown are gone (both arecharin main's headers), and UpdateCamel steps by one with++/--.quick_diffgives the same listing for each file before and after.conston its locals and names its look-around loop variableotherMother; UpdateCamel and UpdateMother gain one comment each where the shape needs a reason; one repeated comment in UpdateFireEater is gone.quick_diffgives the same listing for each file before and after, and a small build of this branch's head with the option off (294 files, 0 failures) reads all four at 100.0% / 100.0%.openshc-pr-fixfinds nothing to change, andopenshc-pr-checkgives 0 errors and 32 notes, all of the kinds below.With
OPENSHC_FUNCTION_VISIBILITY_UNITSonmakeUnitStopWalkingByClearingPathProgressState,checkIfCitizenUnitIsAliveBasedOnState,hasUnitReachedDestination,changeDestinationByAmount). Under/GLit also seesupdateBuildingSignpostCounter,commitUnitLocation,resetUnitMovementStateandsetUnitFacingDirectionTowardsTarget, so in the wrapper it reads 96.5%. We left the entry as it is. A follow-up can name the other four callees there once that is measured against the wrapper's other members./GLlist, so it can't see them. Main's UpdatePriest, a/GLunit without an entry too, does the same in main's full builds (100.0% off, 72.0% on). Giving UpdateMother an entry is left for a follow-up.Kept as they are
(char)onengineerManningSiegeStateRef_checkType(UpdateLady once, UpdateMother twice): in these files the field holds the fade step (2, -2 or -1) that is added to thechardisappearFadeAlphaCountdown, so the tests read it signed. It is abytein the header, and main's other users store 254 and 255 into it, so retyping it tocharis left as a header follow-up (below).(int)onfixedRng + mapTimeInTicksin UpdateCamel:mapTimeInTicksis unsigned, and the cast makes the% 20signed, as the original computes it.(short)on the slot stores (= (short)DAT_CurrentUnitSlotID::instance), as main's unit functions write them.% 22) and UpdateFireEater on a random number (% 3) and ontargetingType, which holds the fire eater's step count, so theUnitInstructionTypenames would not describe it.BOOLEnumfields tested by truthiness, other fields compared with 0:animationCycleNumberHasJustIncrementedis aBOOLEnum. UpdateCamel'sunknownBool01(a countdown) and UpdateMother'sisDisappearingUnk(ashortused as a flag) areshort, andDAT_UnitHasBecomeIdleis anundefined4; they are compared with 0, as main does (main has 96!= 0/== 0tests ofDAT_UnitHasBecomeIdle). The checker sees one file doing both.field_0x3f4,field_0x3c2, the frame tablesfield_0x6194and on), which we have nothing better for. UpdateCamel'sfield3168_0x2790is counted up once per camel per update.Differences from the draft
someCount46 == 0. The original jumps to the go-home block on that test (jeat 0x00546CFF and at 0x005471DB). Five of the draft's six tests readsomeCount46 == 0the other way, as a reason to stay; only the fire state's test had it this way. Outside skirmish she goes home whensumOfTotalEnemyUnitsCount != 0. WhatsomeCount46counts is not known yet.Header follow-ups (not changed here)
DWORD_00ee104candDWORD_00ee1048hold thetimeGetTime()of the lastFX_BABYandFX_GIRL_SCREAM.BuildingLogicalStatehas no 0 value, whilelogicalState == 0marks a free building slot.Unit::unknownBool01(Unit.hpp:273) is a countdown, not a bool.DAT_UnitHasBecomeIdleholds only 0 and 1: aBOOLEnumcandidate.Unit::engineerManningSiegeStateRef_checkTypereads as a signed fade step here (above).Other PRs
cmake/compiler-flags-gl.txt, so whichever goes in later gets a one-line conflict there: keep all the lines.renderDebugDataCurrentPlayerData,applyGateOrDrawbridgeOpenCloseChange,initializeGatePathfindingForOwner,updatePathLinkageTileMap,UpdateGateHouseLarge,UpdateGateHouseSmall,UpdateWoodGate1,findBestAttackTileByPathCost,resetTileAndClearMoat,GateOpenOrClose,ClickOpenOrCloseGate,TransformAndRenderPercentage). All the builds above left them out, with their resolvers off. This PR doesn't touch them.🤖 Generated with Claude Code