Expand description
StorageComponent ledgers and town storage search (Game). See docs/CITIZEN-AI.md and
docs/RESOURCE-PRODUCTION-FLOW.md.
Structs§
- Item
- A StorageComponent entry (16 bytes): the raw material, the count and the reserved count.
- RawMaterial
- RawMaterialDescription: a template shared by ledger entries, not a stored entity.
- Storage
- A storage: its capacity and the goods in it, with their reservations.
- Storage
Match - The result of a storage search: the storage and what it offers.
- Storage
Site - Registration in the manager’s ordinary (
+0/+8) or market list.
Constants§
- STOCK_
SLOTS - The Status Bar stock slots (
Game →, 0x20 bytes each): wood, stone, iron, firewood, tools, food, herbs, clothes, alcohol, coal, textile, custom 0..9.
Traits§
- Storage
Search Map - What the storage search needs from the map: distances, reach and the markets’ areas.
Functions§
- consume_
stored - The
ConsumeRawMaterialaction: take goods out of a storage. Reserved requests skip the check that the goods are there; the changes happen in list order. - distribute
- Hand out up to
capsingle units of the candidates matchingmask, round-robin over the candidates and one unit per storage per pass, until the cap is reached or a pass adds nothing. - find_
material_ storage - The storage nearest
cell(entrance path rank) that holdscountofmaterial(putfalse) or can take them (puttrue). Ordinary storages, then markets;excludeis skipped. A StorageLocation must accept the material’s flags. On a strict entrance-rank improvement the target point (slot scan, or a market use point) must exist with its own rank below the best, and the best becomes the entrance rank. - find_
storage - Strict rank improvements, radius-list precedence, then storage. The covered-home flag is sticky after eligible material selection, even if its slot fails.
- pickup_
stored - The
PickupStoredRawMaterialaction: a citizen takes goods from a storage. A request of zero or less takes as much as the citizen can still carry (by weight). - scan_
storages - The markets (radius list), then the storages, each taking a strictly better rank than
best. Withhome, a market whose radius covers the home ends the search after the markets; without it, every storage is weighed. Returns the best rank and its match. - stock_
slot - Which slot a raw material counts towards, in the original’s test order (food, then firewood, then single flag bits).
- stock_
table - Recompute the stock table from every storage.