Skip to content

fix(coop): base equipment screens hand out starting gear in item-id order - #239

Merged
NonPolynomialTim merged 2 commits into
mainfrom
claude/fix-autoequip-parity-1ca656
Nov 7, 2026
Merged

NonPolynomialTim merged 2 commits into
mainfrom
claude/fix-autoequip-parity-1ca656

Conversation

@NonPolynomialTim

Copy link
Copy Markdown
Collaborator

Problem

When the Soldiers inventory screen or a craft equipment screen opens, every soldier without a saved layout is auto-equipped from the base or craft items. In co-op, the host and the client often showed the same soldier carrying different gear.

Item containers are keyed by item rule pointer, so walking one follows memory addresses. Those differ between launches and between the two machines, so the auto-equip pool came out in a different order on each.

Fix

On the two base screens, each container's items are listed by item id before the pool is built. That is the order containers had while they were keyed by item name, and the order vanilla OpenXcom still uses. Battle start keeps the container's own order. Solo base screens get the same order as co-op.

Tests

  • New test_shared_base_autoequip_parity: both machines open each screen at once and compare every soldier's gear, over 8 fresh SHARED boots per run.
    • Unchanged build: failed 5 of 5 runs (soldier screen: 3 to 6 of 8 boots differed; craft screen: 2 to 3 of 8).
    • This branch: passed 3 of 3 runs, 0 of 8 boots differed on either screen.
  • Existing tests that open these screens pass on this branch: test_shared_base_equip, test_coop_peer_equip_screens, test_unload_weapon_crash, test_coop_transferred_equipment, test_practice_rejoin, test_separate_single_world, test_landing_reply_practice, test_base_partner_view, test_shared_craft_loads.

…g gear on both machines

Opens the Soldiers inventory and the craft equipment screen on the host
and the client at once, from a SHARED world where every soldier's layout
is empty, and compares what auto-equip gives each soldier. The order of
the screen's item pool comes from each game's memory layout, so one boot
shows the difference only some of the time; the rows count over eight
fresh boots. Fails on the current build.
…rder

An item container is keyed by item rule pointer, so walking it follows
memory addresses. Those differ between launches and between the two co-op
machines, so the Soldiers inventory and craft equipment screens auto-equipped
the same soldier with different gear on the host and the client.

The base screens now list each container's items by item id before building
the auto-equip pool. That is the order containers had while they were keyed
by item name, and the order vanilla OpenXcom still uses. Battle start keeps
the container's own order.
@NonPolynomialTim
NonPolynomialTim enabled auto-merge (squash) November 7, 2026 08:57
@NonPolynomialTim
NonPolynomialTim merged commit b13b275 into main Nov 7, 2026
11 checks passed
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.

1 participant