refactor loadout pools for vectorized ship and weapon classes - #7679
Open
Goober5000 wants to merge 1 commit into
Open
refactor loadout pools for vectorized ship and weapon classes#7679Goober5000 wants to merge 1 commit into
Goober5000 wants to merge 1 commit into
Conversation
Convert ship/weapon loadout pools from naive per-class arrays to ordered maps that list loadout entries. Each entry represents a ship/weapon class and its count. An absent entry means the class is not in this mission's loadout. Since these are ordered maps, iteration of the map keys occurs in the same sequence as iteration of `Ship_info` or `Weapon_info`. Includes several bugfixes: - `csg_read_loadout` now clears both pools before reading. Previously the pools were only zeroed in `mission_campaign_init` - `restore_wss_data`: non-transmitted classes are now absent rather than memset to 0 - a copy-paste bug where the weapon pool entries were bounds-checked against MAX_SHIP_CLASSES - `wss_maybe_restore_loadout`: the pool write-back now preserves loadout membership instead of writing a count for every class - `ss_dump_to_list`/`ss_swap_list_slot`: returning a slot ship whose class is not in the pool now makes it available instead of silently losing it. Unreachable in retail but reachable via script - off-by-one errors in the Lua `Ship_Pool`/`Weapon_Pool` indexers Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Goober5000
force-pushed
the
refactor/loadout_pools
branch
from
August 3, 2026 05:28
3d7131d to
77186c7
Compare
Goober5000
marked this pull request as ready for review
August 3, 2026 05:29
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.
Convert ship/weapon loadout pools from naive per-class arrays to ordered maps that list loadout entries. Each entry represents a ship/weapon class and its count. An absent entry means the class is not in this mission's loadout. Since these are ordered maps, iteration of the map keys occurs in the same sequence as iteration of
Ship_infoorWeapon_info.Includes several bugfixes:
csg_read_loadoutnow clears both pools before reading. Previously the pools were only zeroed inmission_campaign_initrestore_wss_data: non-transmitted classes are now absent rather than memset to 0wss_maybe_restore_loadout: the pool write-back now preserves loadout membership instead of writing a count for every classss_dump_to_list/ss_swap_list_slot: returning a slot ship whose class is not in the pool now makes it available instead of silently losing it. Unreachable in retail but reachable via scriptShip_Pool/Weapon_PoolindexersAnother step toward dynamic ship limits.
Depends on #7672; in draft until that is merged.