Repository navigation
stats(P).researched and .upgrades read Brood War's own rows - #92
Closed
mstephenhunt wants to merge 1 commit into
Closed
mstephenhunt wants to merge 1 commit into
mstephenhunt wants to merge 1 commit into
Conversation
The game keeps Brood War's techs (ids 24-43) and upgrades (ids 46-60) in tables of their own, 20 and 15 a player wide. stats() had one table for each, 24 and 46 wide, so P1's Restoration was P2's Stim Packs, and P12's ran past the table. A Brood War key now lands in its row of techResearchedBW (0x58F140) or currentUpgradeLevelBW (0x58F32C), the places BWAPI's BWGame.h gives. The simulator keys a cell by its row's base too, so a Brood War id and the original id at the same place in the row stay apart, and placeOfAddress names the Brood War rows. Fixes scm-js#91. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 12, 2026
Contributor
Author
|
Closing in favor of #96, which now carries this PR's commits along with the rest of the auto-mining, auto-restore and toggle work, so it can be reviewed and merged as one PR. |
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.
Fixes #91.
Why
I'm building a TrigScript library call that makes Medics cast Restore on their own, and it has to check whether the Medic's owner has researched Restoration.
stats(P1).researched[techs.Restoration]read Player 2's Stim Packs instead, and that goes for every Brood War tech and upgrade.What changes
techResearchedBW, 20 bytes a player at0x58F140, andcurrentUpgradeLevelBW, 15 bytes a player at0x58F32C(BWAPIBWGame.h, Game at0x57F0F0+0x10050/0x1023C). A key from 24 (techs) or 46 (upgrades) up now lands atkey - 24/key - 46in that row. The original ids are unchanged.stats(P1).researched[techs.Restoration]andstats(P1).researched[techs.StimPacks], both 0 bytes into their rows now, stay separate cells.placeOfAddressnames an address in the Brood War rows as thestats()field it is, instead of "no table TrigScript knows".Both new tables are covered by the allowlist's
0x57F0F0entry. I haven't read or written them in a played Remastered game yet.Testing
npm run typecheckandnpm test(1,447 passed).tests/ownGame.test.tsdecodes the Set Deaths each write emits: P1 Restoration →0x58F140, P12 Restoration →0x58F140 + 220, P3 Caduceus Reactor →0x58F32C + 35, and P2 Stim Packs / P1 Protoss Ground Armor where they were. It fails on main.tests/eud-error.test.tsline for a Brood War address; fails on main.tests/units.test.tscase: Restoration and Stim Packs for the same player are separate cells in the simulator.