Skip to content

Read warehouses in Warehouses.load_dict (symmetric with serialization)#436

Merged
rp- merged 1 commit into
pydcs:masterfrom
MacrayBlackhand:fix-warehouses-load-dict-drops-warehouses
Jun 13, 2026
Merged

Read warehouses in Warehouses.load_dict (symmetric with serialization)#436
rp- merged 1 commit into
pydcs:masterfrom
MacrayBlackhand:fix-warehouses-load-dict-drops-warehouses

Conversation

@MacrayBlackhand

Copy link
Copy Markdown
Contributor

Warehouses.load_dict reads only data["airports"] and silently drops
data["warehouses"], so unit/FARP/ship warehouse state is lost on every
save->load round-trip even though the serializer writes it. This is the read-side
mirror of the write-side gap in #427 -- together, unit warehouse state survives
neither save nor reload.

Read the warehouses sub-dict symmetrically with the airports loop.

Adds a round-trip test that loads a payload with a warehouse entry and asserts it
survives.

Closes #428.

load_dict read only data["airports"], silently dropping data["warehouses"],
so unit/FARP/ship warehouse state was lost on every save->load round-trip while
the serializer still wrote it. Read the warehouses sub-dict symmetrically.

Closes pydcs#428.

@si0phia si0phia left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no conflicts from these line changes

@rp- rp- merged commit caad081 into pydcs:master Jun 13, 2026
2 checks passed
rp- pushed a commit that referenced this pull request Jun 15, 2026
update_warehouses() runs on every Mission.save(). It unconditionally
overwrote the warehouse entry for every ship-with-parking and every FARP
with a fresh default, discarding any customized warehouse configuration
(coalition, size, inventory, suppliers, operating levels, ...) on every
save. Guard each write so existing entries are preserved and only missing
ones get a default -- gap-fill, matching the docstring's stated intent.

#436 fixed the symmetric read side (load_dict dropped the serialized
"warehouses" sub-dict); this fixes the write side.

Closes #427.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warehouses.load_dict() does not read unit (ship/FARP) warehouse entries; save/load is asymmetric

3 participants