23 Commits

Author SHA1 Message Date
Curtis Merrill 258b80d42b change visitable to item_location, remove item inheritance from visitable, and add item_location inheritance from visitable.
Co-Authored-By: dobbry-vechur <259678433+dobbry-vechur@users.noreply.github.com>
2026-09-30 21:34:09 -04:00
Curtis Merrill a9381f8785 move all crafting_inventory operations to temp_crafting_inventory class (#88606)
* move all crafting_inventory operations to temp_crafting_inventory class

* fix rebase errors

move some functions back to where they were

adjust operator=

use pseudo items and item_location in form_inventory

remove obsolete comment

* add pseudo item dedup

* check for empty item_location in visitable

* iterate over copies items as well

* pseudo item

* Update temp_crafting_inventory.cpp

* fix some compile errors

* Update craft_attention_test.cpp

* Update temp_crafting_inventory.cpp

* address clang_tidy

* dump non const

* Apply batched suggestions from code review

IWYU

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* IWYU

* IWYU

* clang

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-16 22:09:02 -05:00
dobbry-vechur 092ca7b557 Multimag: matrix mod coverage and capacity save/load round-trip tests
- add ensure_synth_mod builder and a MOD pocket on synth hosts
- add matrix cases for gunmod mode override, consumption_mods, capacity_mods
- assert capacity_mult re-derives across an item save/load round-trip
- filter synth pocket counts to magazine pockets in existing matrix cases
2026-06-14 20:22:41 +04:00
dobbry-vechur 1782c305b6 Multimag: per-pocket capacity_mods scaling on mods
- add islot_mod capacity_mods with pocket_capacity_mod multiply
- add non-serialized item_pocket capacity_mult with accessors
- scale ammo_capacity by capacity_mult, clamp remaining at zero
- route item ammo_capacity and remaining_ammo_capacity through the pocket
- restamp capacity_mult from installed mods in update_modified_pockets
- diagnose capacity_mods on non-integral-MAGAZINE pockets
- add capacity_mods test items and tests
2026-06-14 20:22:41 +04:00
dobbry-vechur 73a04ec1aa Multimag: per-pocket consumption_mods override on mods
- add islot_mod consumption_mods with pocket_consumption_mod set/multiply
- apply overrides in effective_qty, min set then product of multiplies
- add validate_mod_pocket_refs for unknown and duplicate pocket ids
- run validate_mod_pocket_refs from update_modified_pockets
- add consumption_mods test items and tests
2026-06-14 20:22:41 +04:00
dobbry-vechur 987c1633d2 Multimag: gun mods supply per-mode firing requirements and hide modes
- add islot_gunmod firing_requirements from key mode_firing_requirements
- add islot_gunmod hide_modes
- resolve firing cost from the gunmod owning the mode-def
- erase hidden modes from gun_all_modes, reselect on hide
- add firing_mode_blocked, guard shots_remaining, consume_shots, targeting
- guard gun_cycle_mode against an empty mode set
- validate gunmod mode keys against mode_modifier
- add multimag gunmod test items and tests
2026-06-14 20:22:41 +04:00
dumb-kevin 3a2f8d251f Fix display_name crash on barrel-swappable guns
- guard find_template(ammo_default())->ammo deref in display_name
- skip max_amount when ammo template has null ammo slot
- add multimag SECTION covering bare robofac_gun display_name
2026-05-20 17:31:56 +04:00
dumb-kevin a409ab6774 Multimag: unload drains integral pockets alongside wells
- Drain live integral MAGAZINE pockets on multimag hosts in unload
- Merge wells and integral pockets into single unload picker
- Add regression test for dual-source unload
2026-05-18 23:35:31 +04:00
dumb-kevin b340a48447 Multimag: validator, pretend_fire, reload-chain test
- Validate firing_requirements MAGAZINE_WELL has default_magazine
- Branch npc::pretend_fire on uses_firing_requirements via consume_one_shot
- Add reload-chain regression test for sibling well auto-queue
2026-05-18 23:35:30 +04:00
dumb-kevin 66395d44ce Fix multimag info crash and per-pocket capacity misreads
- Gate gun_info ammo-fallback on has_ammo_data, not aggregate ammo_remaining
- Null-check curammo and consumable-wear ammo_data derefs
- Resolve ammo_capacity(ammotype) via new pocket_for_ammo helper
- Aggregate integral MAGAZINE pockets in ammo_remaining, skip CASING
- Add per-well display_name labels to Capacity and Ammunition lines
- Add per-mode Per-shot consumption block for firing_requirements guns
- Replace reload_option 3-arg ctor with named POCKET_FALLBACK sentinel
- Pin battery-only-loaded casing skip and per-pocket capacity tests
2026-05-18 23:35:30 +04:00
RenechCDDA f4fe00d113 De-charge a bunch of stuff that should never have had charges (2) (#87006) 2026-05-15 23:23:28 +02:00
dumb-kevin 788cd6ccbf Fix multimag integral magazine display and reload paths
- Anchor ammo accessors and display per-pocket on multimag guns
- Skip CASING in pocket counts; pocket-scoped integral capacity math
- Add integral MAGAZINE as reload target; eject casings before reload
- Compact per-pocket sidebar; guard find_template/format_entry_name on empty id
- Add regression tests covering display, reload, fire, accessors
2026-05-11 17:07:23 +04:00
dumb-kevin 387e158bb1 Skip incompatible-ammo fire gate for multimag guns
- Skip fire_wielded_weapon ammo-mismatch gate when uses_firing_requirements
- Add test_multimag_gun_integral_ammo fixture to TEST_DATA
- Add regression test for multimag fire path
2026-05-10 06:54:52 +04:00
dumb-kevin bf78907e56 Multimag: bind only sufficient tank, render panel when out of ammo
- prepare_multimag_pockets skips tanks that cannot cover one shot
- aim panel runs multimag branch ahead of OUT OF AMMO catch
- short pocket rows render in red so player sees the deficit
- new SECTIONs: USE_UPS isolation, two-tank picker sufficiency
2026-05-05 16:44:13 +04:00
dumb-kevin 88e94e2e87 Multimag: vehicle turret integration core
- dropped firing_requirements rejection in mountable_gun_filter
- dropped VEHICLE early-out in fire_gun, null carrier on multimag drain
- added mm_bindings_ to turret_data; multimag query/prepare_fire/post_fire
- extended prepare_multimag_pockets with mode + preferred_primary args
- skip prep for non-empty pockets; tank picker prefers preferred_primary
2026-05-05 12:21:19 +04:00
dumb-kevin d02ae80b5b Multimag: dedup shared external pool in inventory charges_of
- split charges_of_internal into scan + apply_external_pools
- apply_external_pools branches LEGACY vs MULTIMAG semantics
- multimag aggregate delegates per-tool feasibility to feasible_uses
- legacy aggregate sums local raw charges, adds UPS / bionic once
- multimag external pool routes via main, includes ground UPS
- inventory::charges_of scans every match into one entry list
- expose item::feasible_tool_uses for arbitrary external budgets
- add test_multimag_vehicle_welder TEST_DATA fixture
- cover multimag external pool routing, ground UPS, inventory dedup
- cover legacy USE_UPS dedup at charges_per_use 1 and 20
2026-05-05 12:21:19 +04:00
dumb-kevin 91f07695e8 Migrate audit-tail drains, UI messages, predicates, inventory aggregation
- Switch direct drains to consume_tool_uses / consume_one_shot across activity / iuse / melee
- Switch insufficient-charge UI messages to format_consumption_requirements
- Switch item_action comparator to expected_cost_per_use
- Switch first-aid and AMMO_IN_NAMES gates to needs_charges_to_use
- Switch writing-tool page-capacity check to tool_uses_remaining
- Always label per-well ammo in multi-well tname
- Add multimag branch to visitable::charges_of_internal
- Match writing-tool precheck to local-only crafting drain
- Match hacksaw prompt to actual activity tick count
- Revert book_binder and multi_cooker to ammo_consume for raw-charge tools
- Cover the no-charges_per_use shape with a regression test
2026-05-02 05:45:14 +04:00
dumb-kevin 730974501a Add multimag test fixtures, primitive coverage, deferred-site markers
- Add test_multimag_gun_consume, _tool_consume, _throttled, _factor fixtures
- Cover predicates, primary_ammo_pocket selection, ammo_data routing
- Cover tool_uses_remaining feasibility with non-fungible local stock
- Cover consume_shots and consume_tool_uses per-pocket drain across modes
- Cover hard-guards on ammo_consume(qty) and consume_charges
- Cover legacy_charges_per_use_factor non-divisible hard-fail
- Cover format_consumption_requirements scaling
- Cover gunmod modifier classification, primary-ammo vs energy-channel
- Cover process_tool turns_per_charge throttling
- Cover charges_of aggregation and item_action ranking on multimag tools
- Add TODO(multimag) markers at deferred sites in src
2026-05-02 05:44:35 +04:00
dumb-kevin 10edf6e496 Initial spawn fills every magazine well
- add item::dress_magazine_wells walking base and gunmod wells
- iterate wells in item_group / mapgen / vehicle / npc dressing
- top up present-but-empty magazines on the ammo roll
- reject item-wide charges on multi-well items with debugmsg
- drop reliance on itype::magazine_default map in mondeath
2026-04-30 17:09:58 +04:00
dumb-kevin 2a500b0110 Wire reload UI to per-pocket targeting
- emit per-well reload targets via list_ammo per_well_targets
- prompt to disambiguate when multiple wells accept same ammo
- preserve user-adjusted partial qty across same-ammo entries
- add test_multimag_gun_same_type fixture
- extend multimag tests for per-pocket routing
2026-04-30 06:42:54 +04:00
dumb-kevin 43e30f94b2 Add per-pocket reload targeting API
- Add reload_option pocket_index field plus matching constructor
- Branch item::reload on pocket_index with per-pocket revalidation
- Plumb pocket_index through reload_activity_actor and serialization
- Add list_ammo per_well_targets flag with pocket-scoped compat filter
- Add per-well ammo_remaining/ammo_capacity/remaining_ammo_capacity overloads
2026-04-30 06:42:54 +04:00
dumb-kevin f9d0530377 Display + relaxation across all magazine wells
- ammo_remaining sums across every loaded MAGAZINE_WELL pocket
- remaining_ammo_capacity reports first MAGAZINE_WELL fallback
- display_name builds per-well "(amount/max class, ...)" segments
- item_info pluralizes Magazine label via n_gettext
- Character::unload ejects every loaded magazine, not just the first
- rate_action_unload returns good when any well has a magazine
- wield-collision check rejects any loaded magazine, not just first
2026-04-30 06:42:53 +04:00
dumb-kevin e5b78e61e3 Remove single-magazine assumptions in item_contents
- ammo_consume: iterate all MAGAZINE_WELL pockets instead of
  early-returning on the first empty well
- first_ammo: guard against empty wells (was UB via pocket.front()
  on empty pocket), continue to next well instead of unconditional
  return
- Add magazines_current() returning all loaded magazines
- Add const overloads for magazine_current at pocket/contents level
- Fix item::magazine_current() const to use proper const path
  instead of const_cast
- Add test_multimag_gun fixture with two MAGAZINE_WELL pockets
- Add tests covering single-well, dual-well, and integral magazine
  paths
2026-04-01 20:45:30 +04:00