magicciv/public
Natalie 1a7fd849c0 feat(@projects/@magic-civilization): 💱 p3-25 step 4 — real trade sourcing + ledger persistence in the headless turn
The core of the rail-1 trade port: inter-player trades now form in the Rust headless
sim from REAL owned-tile resources (no proxy), persist to state, and apply.

- mc-turn::process_trade_phase: source_tradeable_resources sources each player's tradeable
  luxuries + strategics from its cities' owned tiles → deterministic tile_collectibles
  rolls (seed = map_seed ^ coord, stable across turns) → classified via
  GameState.resource_categories (dups kept for MIN_COPIES_TO_TRADE). Replaces the old
  proxy (tile_strategics: Vec::new(), tile_luxuries from traded_luxuries).
- Persists the re-derived swap/sale agreements into state.trade_ledger (retaining the
  persistent OpenBorders/SharedMap), so the projection/view can carry real trades.
- Writes PlayerState.traded_strategics (new serde-default field) + applies net per-turn
  gold flow (gold_flow_for: seller +, buyer −).

Verified: mc-turn source_tradeable_resources_classifies_owned_tile_collectibles
(determinism + classification purity + uncategorized-filtered + empty-categories no-op);
mc-turn+mc-state+mc-player-api 517/0; workspace cargo check clean (new PlayerState field
broke no literals). p3-25 steps 1-4 done; 5-6 remain (project trade deals into the view,
then GDScript view-only).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 01:57:32 -04:00
..
games feat(@projects/@magic-civilization): 💱 p3-25 step 4 — real trade sourcing + ledger persistence in the headless turn 2026-06-26 01:57:32 -04:00
resources refactor(@projects/@magic-civilization): p3-18 — embark gate is data-driven per-player config, not hardcoded 2026-06-25 04:40:14 -04:00