A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Map and info panel: live ownership, and a lost marker for a stayed place taken then lost (Fixes #2542) (#2603)
Eyal Golanbc9831da6539
diff --git a/changelog.d/2542-live-ownership-map.md b/changelog.d/2542-live-ownership-map.mdnew file mode 100644index 000000000..f7a0df04f--- /dev/null+++ b/changelog.d/2542-live-ownership-map.md@@ -0,0 +1,3 @@+### Fixed++- Show live settlement ownership and capture state on the map and in the info panel, including after a captured place is lost.diff --git a/docs/rules/mvp.md b/docs/rules/mvp.mdindex 7d23dabf4..86543ffbd 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -38,27 +38,27 @@ Synthetic #1716 fixtures provide an internal immutable monthly snapshot for futuR-CTRL-001: Only a settlement in `settlement_targets.yaml` may be captured. Each target is an `arab_town` row of `map/settlements_1948.yaml` (Q-TGT-1 (a), owner ruling of 18 October 2026), stands on a land hex of `map/hexes.json` that is its own hex in `map/settlement_hexes.yaml` (one named exception: Ramla's target is (-3, 24), the neighbour nearest Ramla's point, because at 4.4 km Ramla shares its hex (-4, 24) with Rehovot and a unit there would capture it; owner on #1796, 26 October 2026, "Contested + move target"; `ContentLoader.TargetOnANeighbour`; a retreat or a Raid's withdrawal never ends on that hex, and a depopulated Ramla closes that hex, not Rehovot's), names a sourced operation (each source an https URL with a `checked` date) and carries a review status; any other row is a load error naming file and field. The shipped list holds the six rows the owner approved on 19 October 2026 and filled on 21 October 2026 (#793: jaffa, acre, nazareth, lod, ramla, beersheba; Gaza excluded), which the owner sensitivity-reviewed on #793. #799 adds each row's residents outcome (R-CTRL-016) and returns every row to `status: draft` until the owner reviews those fields, so the release gate holds them (D-F5).-R-CTRL-002: Settlement control is an ordinal `SortedDictionary<string, SettlementControl>`. It is written to the state hash as `ctrl{...}` only when non-empty, in ordinal id order; each record field is written only when it differs from its default (R-LOOP-002).+R-CTRL-002: Settlement control is an ordinal `SortedDictionary<string, SettlementControl>`. It is written to the state hash as `ctrl{...}` only when non-empty, in ordinal id order; each record field is written only when it differs from its default (R-LOOP-002). An ownerless, non-depopulated record is the lasting marker that a captured place returned to enemy control; it retains the capture date and whether the residents fled (owner answer, 4 November 2026, #2542: "Keep a 'lost' marker (Recommended)"). This representation and the rules below are shared by `gdd-0.1` and `gdd-0.3`; the legacy loop remains unchanged. On the map, a settlement-control record overlays only that settlement's displayed hex on the dated historical control layer: an Israeli owner uses the Israeli colour and an ownerless record the enemy colour; fronts, zones and armistice lines remain dated display data. The selected-hex panel shows the live holder first and the settlement state detail second (coordinator decision on #2542); with no live record, both map and panel keep the dated path unchanged.R-CTRL-003: Residents and combatants are distinct fields. Residents are a state, inhabited, fled or depopulated, not a count (Q-CAP-2 (b)). Fled is the record's `Fled`, set at capture from the target row's `residents: fled` and never cleared (OWNER QUESTION 2 (b), owner, 24 October 2026, #799); flight is not Deport: it adds nothing to `DisplacedByPlayer` and costs nothing. No rule reads residents as combatants, prisoners, refugee units, labour or a resource; annexation is the one place a later owner-approved rule may say otherwise.-R-CTRL-004: The capture check runs after the route step and each order, and still in resolver step 3 after enemy combat, in ordinal settlement id (Q-CAP-1 (a), Q-CAP-3 (a), owner rulings of 18 October 2026). A target that starts under enemy control, one listed in `mvp.enemy_held_localities` (owner, 21 October 2026, #796), is captured at once when Israeli military units are on its hex and no enemy military unit is; only enemy military units are combatants (Q-CAP-3 (a)), and a halutz holds nothing (#796). Passing through a target does not capture it; only a move's or go-to's stopping hex counts (owner, 23 October 2026, OQ-2: "Instant"). Its record names `israel` as owner and has the state `awaiting_choice`; the preview leaves `Since` unset, and Step stamps the turn's end before the resolver, preserving the date through a same-turn answer. The answer stays deferred until End turn (R-TURN-004). A capture remains when the unit leaves; the player's units stay on the hex. A captured target still awaiting the choice that only enemy military units are on is under enemy control again, and its record is removed (#796). A target not enemy-held at the start (Jaffa, owner ruling of 18 October 2026 on #793, "Only in a what-if") is never captured. The check is an integer rule on unit positions and draws nothing from the RNG. Enemy captures of the player's localities (Q-TGT-2 (c), the plan's R-CTRL-006) are not built yet: with the real starting forces a Syrian unit stands on Degania Alef's hex with no Israeli unit, so the rule would record a capture at the first turn's end (#796). A fled record goes back to enemy control as an ownerless record, `since=<capture date>,fled=1`, instead of being removed, after Raid, the timer's raid, the end-of-game raid and enemy units retaking an awaiting capture alike, and such a record (not depopulated) is no record for the capture check, so the place can be captured again; the new record keeps `fled=1` and takes the new turn's date. `Stamp` dates a fled record as it dates Deport's (OWNER QUESTION 2 (b), owner, 24 October 2026, #799).+R-CTRL-004: The capture check runs after the route step and each order, and still in resolver step 3 after enemy combat, in ordinal settlement id (Q-CAP-1 (a), Q-CAP-3 (a), owner rulings of 18 October 2026). A target that starts under enemy control, one listed in `mvp.enemy_held_localities` (owner, 21 October 2026, #796), is captured at once when Israeli military units are on its hex and no enemy military unit is; only enemy military units are combatants (Q-CAP-3 (a)), and a halutz holds nothing (#796). Passing through a target does not capture it; only a move's or go-to's stopping hex counts (owner, 23 October 2026, OQ-2: "Instant"). Its record names `israel` as owner and has the state `awaiting_choice`; the preview leaves `Since` unset, and Step stamps the turn's end before the resolver, preserving the date through a same-turn answer. The answer stays deferred until End turn (R-TURN-004). A capture remains when the unit leaves; the player's units stay on the hex. A captured target still awaiting the choice that only enemy military units are on is under enemy control again, and its record becomes the ownerless marker of R-CTRL-002. A target not enemy-held at the start (Jaffa, owner ruling of 18 October 2026 on #793, "Only in a what-if") is never captured. The check is an integer rule on unit positions and draws nothing from the RNG. Enemy captures of the player's localities (Q-TGT-2 (c), the plan's R-CTRL-006) are not built yet: with the real starting forces a Syrian unit stands on Degania Alef's hex with no Israeli unit, so the rule would record a capture at the first turn's end (#796). Every ownerless, non-depopulated record is no record for the capture check, so the place can be captured again; the new record keeps its `fled` value and takes the new turn's date. `Stamp` dates every new settlement record, including the stayed lost marker, as it dates Deport's (OWNER QUESTION 2 (b), owner, 24 October 2026, #799).R-CTRL-005: Capture writes the settlement state only. It changes no resident field except that a target whose row says `residents: fled` is recorded with `fled=1` and its capture line says its residents fled (OWNER QUESTION 2 (b), owner, 24 October 2026, #799), no unit, no resource, parameter, city or score, and counts towards no objective (constraint 6 of the Phase 6 plan; impact plan section 4.3).R-CTRL-007: `ResolveCapture(settlement, outcome)` answers a capture. It is one command kind for every outcome, with one `attention_cost.resolve_capture` (Q-TECH-3, owner, 18 October 2026, #783 batch 1), set at 0 as a design value proposed on #797 (D-A6: unit orders are free). It is valid only for a settlement whose record is awaiting the choice, including the turn of its instant capture until it is answered, and only for an outcome that is built. The answer remains deferred and runs at End turn (owner, 23 October 2026; R-TURN-004). Otherwise it is refused with a reason, the state unchanged and the Attention refunded: the place is not awaiting a decision, the outcome is not known, or Deport is not in play: with `mvp.deport_in_play` off, as in the real content until the owner has reviewed Deport's cards and dialog (Phase 6 PRs 9 and 10), it is refused as "not built yet" (R-CTRL-018). The legacy loop refuses it before charging Attention.-R-CTRL-008: `SettlementControl.CaptureOptions(content, state, settlement)` lists the outcomes in one fixed order, Raid and withdraw, Occupy, Deport, so Deport is never first (impact plan section 4.1 item 1). An option carries no default or selected flag. Each option has either the reason it is refused or a preview. A refusal carries a stable id from a fixed list and the values its line needs beyond the place itself (for Attention, what the option needs and what is left), so the dialog shows a reviewed line in the player's language and never reads the English reason the command returns (Q-TECH-5, #802). A preview is the change resolving it makes at once to Attention, Money (the Treasury and the debt), Food, Arms, Social cohesion, International Support and the score, computed by resolving it on a copy of the state, so the preview is the outcome (spec section 2.6). A place not awaiting the choice offers no option. A capture the player does not answer waits, and the units stay (Q-HIST-1 (a), owner, 18 October 2026, #783 batch 3). On the turn that reaches the game's end, where resolver step 10 sits and before objectives and score, every capture still awaiting the choice counts as Raid, in ordinal id order (owner, 18 October 2026 on #797, "Counts as Raid"): the units leave as R-CTRL-010 says, nothing changes for the residents and the score gains nothing. A unit with nowhere to go stays while the others leave, and the record goes all the same. No unanswered choice ever resolves as Deport. A fled place's end-of-game raid keeps its ownerless fled record (R-CTRL-004) (OWNER QUESTION 2 (b), owner, 24 October 2026, #799).+R-CTRL-008: `SettlementControl.CaptureOptions(content, state, settlement)` lists the outcomes in one fixed order, Raid and withdraw, Occupy, Deport, so Deport is never first (impact plan section 4.1 item 1). An option carries no default or selected flag. Each option has either the reason it is refused or a preview. A refusal carries a stable id from a fixed list and the values its line needs beyond the place itself (for Attention, what the option needs and what is left), so the dialog shows a reviewed line in the player's language and never reads the English reason the command returns (Q-TECH-5, #802). A preview is the change resolving it makes at once to Attention, Money (the Treasury and the debt), Food, Arms, Social cohesion, International Support and the score, computed by resolving it on a copy of the state, so the preview is the outcome (spec section 2.6). A place not awaiting the choice offers no option. A capture the player does not answer waits, and the units stay (Q-HIST-1 (a), owner, 18 October 2026, #783 batch 3). On the turn that reaches the game's end, where resolver step 10 sits and before objectives and score, every capture still awaiting the choice counts as Raid, in ordinal id order (owner, 18 October 2026 on #797, "Counts as Raid"): the units leave as R-CTRL-010 says, nothing changes for the residents and the score gains nothing. A unit with nowhere to go stays while the others leave, and the ownerless marker remains all the same. No unanswered choice ever resolves as Deport.R-CTRL-009: `HistoricalAI` answers every capture awaiting the choice with Raid, in ordinal id order, leaving out a Raid the sim would refuse (a unit with nowhere to go), which then waits, and the reference player sends `HistoricalAI`'s orders, so it does too (Q-REF-1 (a), owner, 18 October 2026, #783 batch 3). Neither ever issues Deport, and nothing delegates a capture: `EventSystem.Delegate` answers events only (impact plan section 4.1 item 1).-R-CTRL-010: Raid and withdraw (Q-RAID-1 (a), owner, 18 October 2026, #783 batch 3). The player's units on the place's hex, soldiers and halutzim alike, leave in ascending id, each to the first neighbouring hex in the fixed neighbour order (R-MOVE-002) that is land, holds no enemy unit, is not an enemy-held locality (R-MOVE-005) and has room under the stack limit (R-MOVE-003). Leaving costs no movement points, and the units keep their orders, as after a `Move` that ends on another hex: a fortify is lost at the turn's order step (R-ORDER-002); both are defaults proposed on #797. The record is removed, so the place is under enemy control again at once, and its residents are unchanged. Raid changes nothing else: no resource, parameter, city, score or objective, and no RNG draw. If a unit has no such hex, Raid is refused with a reason and the state is unchanged, so the choice waits. For a fled place the record stays ownerless and fled (R-CTRL-004), and the line says "Its residents fled when it was captured" instead of "Its residents are unchanged" (OWNER QUESTION 2 (b), owner, 24 October 2026, #799).+R-CTRL-010: Raid and withdraw (Q-RAID-1 (a), owner, 18 October 2026, #783 batch 3). The player's units on the place's hex, soldiers and halutzim alike, leave in ascending id, each to the first neighbouring hex in the fixed neighbour order (R-MOVE-002) that is land, holds no enemy unit, is not an enemy-held locality (R-MOVE-005) and has room under the stack limit (R-MOVE-003). Leaving costs no movement points, and the units keep their orders, as after a `Move` that ends on another hex: a fortify is lost at the turn's order step (R-ORDER-002); both are defaults proposed on #797. The record becomes ownerless, preserving `Since` and `Fled`, so the place is under enemy control again at once and its residents are unchanged. Raid changes nothing else: no resource, parameter, city, score or objective, and no RNG draw. If a unit has no such hex, Raid is refused with a reason and the state is unchanged, so the choice waits. For a fled place the line says "Its residents fled when it was captured" instead of "Its residents are unchanged" (OWNER QUESTION 2 (b), owner, 24 October 2026, #799).R-CTRL-011: Occupy (Q-OCC-1 (a), owner, 18 October 2026, #783 batch 3): `ResolveCapture(settlement, occupy)` keeps the place under the player's control. It needs an Israeli military unit on the place's hex, the one unit that stays (a halutz holds nothing, #796), and is refused with a reason otherwise, the state unchanged. It moves no unit. It changes the record's state to `occupied` and starts its timer (R-CTRL-012), and nothing else: no resident field (the place stays inhabited, R-CTRL-003), unit, resource, parameter, city, score or objective, so its preview (R-CTRL-008) is all zeros. Each turn's step 10, while the place is occupied or awaiting `EndOccupation`, the Treasury pays `mvp.occupation_upkeep_per_turn` for it, borrowing what it lacks (R-MONEY-003); the Occupy turn pays too. The upkeep is a design value accepted by the owner on 22 October 2026 (https://github.com/eyalgolan/statecraft-israel/pull/1324#issuecomment-6338594839): IL 0.005m, one month of `income_per_job_per_year` for the one population unit that stays, derived as `held_soldier_cost_per_turn` is. It comes on top of the garrison formation's own `military_upkeep_per_turn` (IL 0.05m, R-UNIT-010), so holding a place costs IL 0.055m a turn in all (owner ruling, 22 October 2026, https://github.com/eyalgolan/statecraft-israel/pull/1324#issuecomment-6341877796). Money is shown to one decimal of IL millions, so when the Treasury has to borrow for it the Why line shows the borrowed amount, at most IL 0.005m, as "IL 0.0m". For a fled place Occupy's line ends "Its residents fled when it was captured", and Occupy and the timer keep `fled=1` on every record (OWNER QUESTION 2 (b), owner, 24 October 2026, #799). The owner's rulings of 27 October 2026 on #1712 (https://github.com/eyalgolan/statecraft-israel/issues/1712#issuecomment-6461246243) keep this flow for capture, "Existing Raid/Occupy", and the occupation "3 turns, keep upkeep" (R-CTRL-012); the owner's ruling of 1 November 2026, "30 Oct wins for the MVP (Recommended)", leaves Occupy as written here for the MVP. It holds unchanged under gdd-0.3: a capture, Occupy, a withdrawal and a retake end every turn as under gdd-0.1, the Attention pool aside (`OccupyTests.WithdrawingOnTurnTwoAndRetakingIsTheSameUnderGdd03`).R-CTRL-012: The occupation timer (Q-OCC-3 (a), owner, 18 October 2026, #783 batch 4: one X for every place). Occupy sets the record's `Turns` to `mvp.occupation_turns`, X, a design value: 3 monthly turns (owner, 27 October 2026, #1712, "3 turns, keep upkeep", https://github.com/eyalgolan/statecraft-israel/issues/1712#issuecomment-6461246243; confirmed by the owner on 1 November 2026, "3 turns (27 Oct)"), replacing the 6 monthly turns the owner accepted on 22 October 2026 (https://github.com/eyalgolan/statecraft-israel/pull/1324#issuecomment-6338594839). Resolver step 10, after step 9's arrivals and before objectives and score (step 11), takes each occupied place in ordinal id order and counts one turn off, the Occupy turn included; at 0 the place's state is `awaiting_end`, where it awaits `EndOccupation` (Phase 6 PR 7) and the count stops. `Turns` is written to the hash as `turns=` only when non-zero (R-CTRL-002). The step draws nothing from the RNG.-R-CTRL-013: Withdrawal before the timer ends (Q-OCC-2 (a), owner, 18 October 2026, #783 batch 3: allowed, and it becomes a Raid). An occupation lasts while an Israeli military unit is on the place's hex. When step 10 finds none on an occupied or `awaiting_end` place (the player moved them out, or they were lost), the occupation ends as a Raid does: the record is removed, so the place is under enemy control again at once, its residents unchanged, and no upkeep is paid that turn. Nothing else changes, and nothing is refunded. A halutz left on the hex keeps nothing. For a fled place the timer's raid keeps the ownerless fled record and its line says the residents fled when it was captured (OWNER QUESTION 2 (b), owner, 24 October 2026, #799). The owner's rulings of 27 October 2026 on #1712 ("Existing Raid/Occupy", "3 turns, keep upkeep"; https://github.com/eyalgolan/statecraft-israel/issues/1712#issuecomment-6461246243) and of 1 November 2026 ("30 Oct wins for the MVP (Recommended)") leave it as written: a withdrawal on the occupation's second turn returns the town and clears its timer, and a retake is a new capture, whose Occupy starts a fresh timer. It holds unchanged under gdd-0.3 (`OccupyTests.WithdrawingOnTurnTwoAndRetakingIsTheSameUnderGdd03`). An operation card's order never takes the last Israeli unit off an occupied place (R-ENEMY-005; owner, 2 November 2026, #2087: "Keep a garrison in Nazareth (Recommended)"). That rule covers only the cards' orders: the player's own orders (a move, a go-to, Send home) and combat (a unit's loss, its surrender, or its retreat after an enemy attack, R-COMBAT-003) can still leave an occupied place with no Israeli unit, and step 10 then ends the occupation as above.+R-CTRL-013: Withdrawal before the timer ends (Q-OCC-2 (a), owner, 18 October 2026, #783 batch 3: allowed, and it becomes a Raid). An occupation lasts while an Israeli military unit is on the place's hex. When step 10 finds none on an occupied or `awaiting_end` place (the player moved them out, or they were lost), the occupation ends as a Raid does: the record becomes ownerless, preserving `Since` and `Fled`, so the place is under enemy control again at once, its residents unchanged, and no upkeep is paid that turn. Nothing else changes, and nothing is refunded. A halutz left on the hex keeps nothing. For a fled place the line says the residents fled when it was captured (OWNER QUESTION 2 (b), owner, 24 October 2026, #799). The owner's rulings of 27 October 2026 on #1712 ("Existing Raid/Occupy", "3 turns, keep upkeep"; https://github.com/eyalgolan/statecraft-israel/issues/1712#issuecomment-6461246243) and of 1 November 2026 ("30 Oct wins for the MVP (Recommended)") leave it as written: a withdrawal on the occupation's second turn returns the town and clears its timer, and a retake is a new capture, whose Occupy starts a fresh timer. It holds unchanged under gdd-0.3 (`OccupyTests.WithdrawingOnTurnTwoAndRetakingIsTheSameUnderGdd03`). An operation card's order never takes the last Israeli unit off an occupied place (R-ENEMY-005; owner, 2 November 2026, #2087: "Keep a garrison in Nazareth (Recommended)"). That rule covers only the cards' orders: the player's own orders (a move, a go-to, Send home) and combat (a unit's loss, its surrender, or its retreat after an enemy attack, R-COMBAT-003) can still leave an occupied place with no Israeli unit, and step 10 then ends the occupation as above.R-CTRL-014: `EndOccupation(settlement, outcome)` answers the end of an occupation (#799). It is one deferred command kind (not instant, R-TURN-004) with one `attention_cost.end_occupation`, set at 0 as a design value proposed on #799 (D-A6: unit orders are free). It is valid only for a place in `awaiting_end` with an Israeli military unit on its hex, as Occupy needs (R-CTRL-011), and an outcome of `annex` or `withdraw`; the unit is checked for both outcomes. Otherwise it is refused with a reason, the state unchanged and the Attention refunded. It draws nothing from the RNG. Saved as `endocc <settlement> <outcome>`; scenario kind `end_occupation`. The owner's rulings of 27 October 2026 on #1712 (https://github.com/eyalgolan/statecraft-israel/issues/1712#issuecomment-6461246243) set the occupation it ends at "3 turns, keep upkeep" (R-CTRL-012), and the owner's ruling of 1 November 2026, "30 Oct wins for the MVP (Recommended)", keeps its outcomes to Annex and Withdraw for the MVP (R-CTRL-015, R-CTRL-016). Each option's preview equals its result (`EndOccupationTests.TheEndPreviewIsTheOutcome`), and annexing a stayed town adds one city and no unit (`EndOccupationTests.AnnexingAStayedRealTownAddsOneCityAndNoUnit`). It holds unchanged under gdd-0.3: Occupy, the three turns, Annex and the unit's leaving end every turn as under gdd-0.1, the Attention pool aside (`EndOccupationTests.OccupyThenAnnexIsTheSameUnderGdd03`).diff --git a/sim/Statecraft.Sim.Tests/CaptureOptionsTests.cs b/sim/Statecraft.Sim.Tests/CaptureOptionsTests.csindex b41fb33e4..de2f72d53 100644--- a/sim/Statecraft.Sim.Tests/CaptureOptionsTests.cs+++ b/sim/Statecraft.Sim.Tests/CaptureOptionsTests.cs@@ -93,6 +93,8 @@ public class CaptureOptionsTests}var next = Simulation.Step(c, s, ReferencePlayer.Commands(c, s));Assert.DoesNotContain(next.Rejected, x => x.Command is ResolveCapture);- Assert.Empty(next.State.Settlements);+ // #2542: each raided place keeps only its ownerless lost marker (R-CTRL-010), never a deported one.+ Assert.Equal(new[] { "town_a", "town_c" }, next.State.Settlements.Keys.ToArray());+ Assert.All(next.State.Settlements.Values, x => Assert.Equal(("", "", false), (x.Owner, x.State, x.Depopulated)));}}diff --git a/sim/Statecraft.Sim.Tests/CaptureTests.cs b/sim/Statecraft.Sim.Tests/CaptureTests.csindex 923c4f03c..2fe2dafea 100644--- a/sim/Statecraft.Sim.Tests/CaptureTests.cs+++ b/sim/Statecraft.Sim.Tests/CaptureTests.cs@@ -133,7 +133,7 @@ public class CaptureTests}// R-CTRL-004 (#796, 21 October 2026): a captured target the enemy holds again, with no player combatant there, is back- // under enemy control.+ // under enemy control, with the ownerless lost marker retained.[Fact]public void AnEnemyUnitHoldingACapturedTargetReturnsItToEnemyControl(){@@ -141,7 +141,23 @@ public class CaptureTestsvar s = With(c, Enemy(1, 1, 0));s.Settlements["town_a"] = new SettlementControl(Movement.PlayerSide, SettlementControl.AwaitingChoice, s.Date);Capture(c, s);- Assert.Empty(s.Settlements);+ var lost = Assert.Single(s.Settlements).Value;+ Assert.Equal(("", "", s.Date, false), (lost.Owner, lost.State, lost.Since, lost.Fled));+ }++ [Theory]+ [InlineData(false)]+ [InlineData(true)]+ public void AStayedLostMarkerCanBeCapturedAgainWithANewDate(bool gdd03)+ {+ var c = OccupyTests.Load(gdd03);+ var s = With(c, Soldier(1, 1, 0));+ var old = s.Date.AddDays(-7);+ s.Settlements["town_a"] = new SettlementControl(since: old);+ var next = s.Date.AddDays(7);+ Capture(c, s);+ var record = s.Settlements["town_a"];+ Assert.Equal((Movement.PlayerSide, SettlementControl.AwaitingChoice, next), (record.Owner, record.State, record.Since));}// R-CTRL-001: a player unit on a locality that is not on the list changes nothing.@@ -307,7 +323,7 @@ public class CaptureTestsvar s = With(c, Soldier(1, 0, 1));var ended = Simulation.Step(c, s, new Command[] { new Move(1, 1, 0), new ResolveCapture("town_a", SettlementControl.Raid) });Assert.Empty(ended.Rejected);- Assert.False(ended.State.Settlements.ContainsKey("town_a"));+ Assert.Equal("", ended.State.Settlements["town_a"].Owner);}// R-CTRL-004: the automatic route stop is checked before any order (spec 4.4, 6.3).diff --git a/sim/Statecraft.Sim.Tests/EndOccupationTests.cs b/sim/Statecraft.Sim.Tests/EndOccupationTests.csindex 1623347ef..69b6f01d5 100644--- a/sim/Statecraft.Sim.Tests/EndOccupationTests.cs+++ b/sim/Statecraft.Sim.Tests/EndOccupationTests.cs@@ -103,7 +103,7 @@ public class EndOccupationTestsAssert.True(s.Settlements["town_a"].Depopulated);}- // R-CTRL-015: withdrawing at the end is the Raid withdrawal: the units leave, the record goes.+ // R-CTRL-015: withdrawing at the end is the Raid withdrawal: the units leave and the ownerless lost marker remains.[Fact]public void WithdrawAtTheEndIsTheRaidWithdrawal(){@@ -111,7 +111,8 @@ public class EndOccupationTestsvar s = AwaitingEnd(c, false, Soldier(2, 1, 0));var after = Simulation.Step(c, s, new Command[] { new EndOccupation("town_a", SettlementControl.WithdrawOutcome) });Assert.Empty(after.Rejected);- Assert.False(after.State.Settlements.ContainsKey("town_a"));+ var lost = after.State.Settlements["town_a"];+ Assert.Equal(("", "", s.Date, false), (lost.Owner, lost.State, lost.Since, lost.Fled));Assert.NotEqual((1, 0), (after.State.Units[2].Q, after.State.Units[2].R));Assert.Contains(after.Why, x => x.Target == "town_a" && x.Message.Contains("Its residents are unchanged"));}diff --git a/sim/Statecraft.Sim.Tests/OccupyTests.cs b/sim/Statecraft.Sim.Tests/OccupyTests.csindex fcc0bb3fa..b127b7636 100644--- a/sim/Statecraft.Sim.Tests/OccupyTests.cs+++ b/sim/Statecraft.Sim.Tests/OccupyTests.cs@@ -137,7 +137,7 @@ public class OccupyTests}// R-CTRL-013 (Q-OCC-2 (a)): withdrawal before the timer ends is allowed and becomes a Raid. The occupation lasts while- // an Israeli military unit is on the hex; when step 10 finds none (the player moved them out), the record goes, the+ // an Israeli military unit is on the hex; when step 10 finds none (the player moved them out), the lost marker remains, the// place is under enemy control again with its residents unchanged, no upkeep is paid that turn and nothing else// changes: the turn ends as the twin's that never captured it.[Fact]@@ -147,14 +147,16 @@ public class OccupyTestsvar s = Step(c, Awaiting(c, Soldier(1, 1, 0)), Occupy()).State;var result = Step(c, s, new Move(1, 2, 0));Assert.Empty(result.Rejected);- Assert.Empty(result.State.Settlements);+ var lost = Assert.Single(result.State.Settlements).Value;+ Assert.Equal(("", "", s.Settlements["town_a"].Since, false), (lost.Owner, lost.State, lost.Since, lost.Fled));Assert.Contains(result.Why, x => x.Target == "town_a" && x.Message.Contains("under enemy control again"));Assert.Contains(Movement.NoEntry(c, result.State), h => h == (1, 0));// Spec 4.4 now captures a unit already on the target before orders. A never-captured twin must start outside.var twin = Without(s);Assert.Null(Movement.Move(c, twin, 1, 2, 0, new Dictionary<int, int>(), new List<Cause>()));Assert.Equal((2, 0), (result.State.Units[1].Q, result.State.Units[1].R));- Assert.Equal(Step(c, twin).State.Describe(), result.State.Describe());+ var without = result.State.Clone(); without.Settlements.Clear();+ Assert.Equal(Step(c, twin).State.Describe(), without.Describe());}// R-CTRL-013: a halutz left on the hex holds nothing (#796), so the occupation still ends.@@ -163,7 +165,7 @@ public class OccupyTests{var c = Load();var s = Step(c, Awaiting(c, Soldier(1, 1, 0), new Unit(2, "halutz", 1, 0)), Occupy()).State;- Assert.Empty(Step(c, s, new Move(1, 2, 0)).State.Settlements);+ Assert.Equal("", Step(c, s, new Move(1, 2, 0)).State.Settlements["town_a"].Owner);}// R-CTRL-003, R-CTRL-011 (Q-OCC-1 (a), "no effect on residents"): Occupy and the occupation change the record's state@@ -256,7 +258,7 @@ public class OccupyTests/// <summary>Plays <paramref name="turns"/> from <paramref name="s"/>, running <paramref name="between"/> on the state/// before each turn's orders (null leaves it alone), and after each turn records <paramref name="id"/>'s record as- /// state/turns ("none" with no record) with soldier 1's hex, and the canonical state with the Attention pool and the+ /// state/turns (an empty state for a lost marker, "none" with no record) with soldier 1's hex, and the canonical state with the Attention pool and the/// ruleset name taken out (NoAttentionTests.WithoutLegacyAccounting).</summary>internal static List<(string Trace, string State)> Play(Content c, GameState s, string id, Action<int, GameState>? between, params Command[][] turns){@@ -288,7 +290,7 @@ public class OccupyTestsnew Command[] { new Move(1, 1, 0) }, new Command[] { Occupy() }, new Command[] { new Move(1, 2, 0) },new Command[] { new Move(1, 1, 0) }, new Command[] { Occupy() },};- var expected = new[] { "awaiting_choice/0@1,0", "occupied/2@1,0", "none@2,0", "awaiting_choice/0@1,0", "occupied/2@1,0" };+ var expected = new[] { "awaiting_choice/0@1,0", "occupied/2@1,0", "/0@2,0", "awaiting_choice/0@1,0", "occupied/2@1,0" };var runs = new[] { false, true }.Select(gdd03 => { var c = Load(gdd03); return Play(c, CombatTests.With(c, Soldier(1, 2, 0)), "town_a", null, turns); }).ToList();Assert.Equal(expected, runs[0].Select(x => x.Trace));Assert.Equal(expected, runs[1].Select(x => x.Trace));diff --git a/sim/Statecraft.Sim.Tests/RaidTests.cs b/sim/Statecraft.Sim.Tests/RaidTests.csindex 4e815cffd..adcfe6696 100644--- a/sim/Statecraft.Sim.Tests/RaidTests.cs+++ b/sim/Statecraft.Sim.Tests/RaidTests.cs@@ -29,8 +29,7 @@ public class RaidTestsstatic ResolveCapture Raid(string id = "town_a") => new ResolveCapture(id, SettlementControl.Raid);// R-CTRL-010 (Q-RAID-1 (a)): the player's units leave, the soldier and a halutz alike, each to the first free- // neighbouring hex, and the place's record goes at once: it is under enemy control again, so the turn's capture check- // finds nobody there and nothing to take.+ // neighbouring hex, and the place keeps only an ownerless lost marker: it is under enemy control again.[Fact]public void RaidWithdrawsThePlayersUnitsAndReturnsThePlaceToEnemyControl(){@@ -38,22 +37,25 @@ public class RaidTestsvar s = Awaiting(c, Soldier(1, 1, 0), new Unit(2, "halutz", 1, 0));var result = Step(c, s, Raid());Assert.Empty(result.Rejected);- Assert.Empty(result.State.Settlements);+ var lost = Assert.Single(result.State.Settlements).Value;+ Assert.Equal(("", "", s.Date, false), (lost.Owner, lost.State, lost.Since, lost.Fled));Assert.Equal((2, 0), (result.State.Units[1].Q, result.State.Units[1].R));Assert.Equal((2, 0), (result.State.Units[2].Q, result.State.Units[2].R));Assert.Contains(result.Why, x => x.Target == "town_a" && x.Message.Contains("under enemy control again"));Assert.Contains(Movement.NoEntry(c, result.State), h => h == (1, 0)); // no withdrawal ends on it (R-CTRL-010)}- // R-CTRL-010 (Q-RAID-1 (a), "residents unchanged"): Raid changes the units' hexes and removes the record, and nothing- // else: the turn ends exactly as it does for a twin whose units were moved by hand and whose record was never written.+ // R-CTRL-010 (Q-RAID-1 (a), "residents unchanged"): Raid changes the units' hexes and replaces the capture with the+ // ownerless marker, and nothing else.[Fact]public void RaidChangesOnlyTheUnitsHexesAndTheRecord(){var c = Load();var s = Awaiting(c, Soldier(1, 1, 0));- var twin = CombatTests.With(c, Soldier(1, 2, 0));- Assert.Equal(Step(c, twin).State.Describe(), Step(c, s, Raid()).State.Describe());+ var next = Step(c, s, Raid()).State;+ var without = next.Clone(); without.Settlements.Clear();+ var twin = Step(c, CombatTests.With(c, Soldier(1, 2, 0))).State;+ Assert.Equal(twin.Describe(), without.Describe());}// R-CTRL-010: a neighbour with an enemy unit, or one already full under the stack limit (the fixture's 2), is passed@@ -66,7 +68,7 @@ public class RaidTestsvar next = Step(c, s, Raid()).State;Assert.Equal((0, 0), (next.Units[1].Q, next.Units[1].R)); // (2, 0) holds an enemy unitAssert.Equal((0, 1), (next.Units[2].Q, next.Units[2].R)); // (0, 0) now holds two Israeli units- Assert.Empty(next.Settlements);+ Assert.Equal("", next.Settlements["town_a"].Owner);}// R-CTRL-010, R-CTRL-007: when a unit has no free hex to withdraw to, Raid is refused with a reason, the Attention is@@ -82,9 +84,22 @@ public class RaidTestsAssert.Contains("A unit has no free hex", SettlementControl.Resolve(c, s, "town_a", SettlementControl.Raid, why));Assert.Empty(why);Assert.Equal(before.Describe(), s.Describe());+ Assert.Equal(before.Hash(), s.Hash());Assert.Single(Step(c, before, Raid()).Rejected);}+ [Fact]+ public void TheLegacyLoopStillRefusesCaptureChoicesWithoutChangingTheirPreview()+ {+ var c = ContentLoader.Load(Fixture.Write()); // legacy content, as EraSystemsTests.WithoutTheSwitchTheLoopIsLegacy+ Assert.False(c.IsGdd);+ var s = Simulation.NewGame(c, 1, Mode.Historical);+ var before = Simulation.Preview(c, s, Array.Empty<Command>());+ var result = Simulation.Preview(c, s, new Command[] { new ResolveCapture("town_a", SettlementControl.Raid) });+ Assert.Equal("That order is not available in this game", Assert.Single(result.Rejected).Reason);+ Assert.Equal(before.State.Hash(), result.State.Hash());+ }+// R-CTRL-007: ResolveCapture is valid only for a settlement awaiting the choice, and only for an outcome that is built;// otherwise it is refused with a reason and the state is unchanged.[Theory]@@ -125,7 +140,7 @@ public class RaidTests}// R-CTRL-008 (#797, "Counts as Raid"): on the turn that reaches the game's end, a capture still waiting resolves as- // Raid: the units leave and the record goes, and the end state, score included, is the twin's that raided by hand.+ // Raid: the units leave and the ownerless marker remains.[Fact]public void ACaptureStillWaitingAtTheEndCountsAsRaid(){@@ -135,26 +150,27 @@ public class RaidTestss.Date = twin.Date = c.End.AddDays(-10); // the next turn ends on the game's endvar result = Step(c, s);Assert.NotNull(result.State.GameOver);- Assert.Empty(result.State.Settlements);+ Assert.Equal("", result.State.Settlements["town_a"].Owner);Assert.Equal((2, 0), (result.State.Units[1].Q, result.State.Units[1].R));var raid = Assert.Single(result.Why, x => x.Target == "town_a" && x.Key == CauseKeys.PendingBecameRaid);Assert.Equal(c.SettlementNames["town_a"] + ": no decision was made before the game ended, so it counts as a raid", raid.Message);var other = Step(c, twin).State;Assert.Equal(other.Score, result.State.Score);- Assert.Equal(other.Describe(), result.State.Describe());+ var without = result.State.Clone(); without.Settlements.Clear();+ Assert.Equal(other.Describe(), without.Describe());}- // R-CTRL-008: at the end, a unit with nowhere to go stays while the others leave, and the record still goes (the game- // is over). Unit 1 fits on (2, 0) beside unit 7; unit 6 then has no room, and enemy units hold the other neighbours.+ // R-CTRL-008: at the end, a unit with nowhere to go stays while the others leave, and the record becomes ownerless (the game+ // is over). The lost marker still remains. Unit 1 fits on (2, 0) beside unit 7; unit 6 then has no room, and enemy units hold the other neighbours.[Fact]- public void AtTheEndTheRecordGoesEvenWithNowhereToWithdraw()+ public void AtTheEndTheLostMarkerRemainsEvenWithNowhereToWithdraw(){var c = Load();var s = Awaiting(c, Soldier(1, 1, 0), Soldier(6, 1, 0), Soldier(7, 2, 0), Enemy(3, 0, 0), Enemy(4, 0, 1), Enemy(5, 1, 1));s.Date = c.End.AddDays(-10); // the next turn ends on the game's endvar next = Step(c, s).State;Assert.NotNull(next.GameOver);- Assert.Empty(next.Settlements);+ Assert.Equal("", next.Settlements["town_a"].Owner);Assert.Equal((2, 0), (next.Units[1].Q, next.Units[1].R));Assert.Equal((1, 0), (next.Units[6].Q, next.Units[6].R));}diff --git a/sim/Statecraft.Sim.Tests/RemainingCauseKeysTests.cs b/sim/Statecraft.Sim.Tests/RemainingCauseKeysTests.csindex 3067b2bec..bada68743 100644--- a/sim/Statecraft.Sim.Tests/RemainingCauseKeysTests.cs+++ b/sim/Statecraft.Sim.Tests/RemainingCauseKeysTests.cs@@ -394,8 +394,9 @@ public class RemainingCauseKeysTests+ (fled ? "Its residents fled. " : "") + "It awaits a decision", captured.Message);Assert.Equal("TOWN A: Israeli units withdrew and it is under enemy control again. "+ (fled ? "Its residents fled when it was captured" : "Its residents are unchanged"), withdrawn.Message);- // Release leaves no stayed record; the stored line must still carry the prior resident state.- if (!fled) Assert.False(result.State.Settlements.ContainsKey("town_a"));+ // Release leaves an ownerless lost marker with the residents' state (#2542); the stored line must still carry it.+ var marker = result.State.Settlements["town_a"];+ Assert.Equal(("", fled), (marker.Owner, marker.Fled));result.State.Settlements.Clear();Assert.Equal(fled ? "1" : "0", withdrawn.Args[1]);}diff --git a/sim/Statecraft.Sim.Tests/SaveGameTests.cs b/sim/Statecraft.Sim.Tests/SaveGameTests.csindex 06592142b..a3fc18550 100644--- a/sim/Statecraft.Sim.Tests/SaveGameTests.cs+++ b/sim/Statecraft.Sim.Tests/SaveGameTests.cs@@ -108,6 +108,58 @@ public class SaveGameTestsAssert.Equal(played.Previous!.Hash(), loaded.Previous!.Hash()); // "since last turn" survives a load}+ /// <summary>#2542: gdd-0.1 and gdd-0.3 saves replay the stayed lost marker. A same-content save made before the marker+ /// existed is accepted only when removing that marker reproduces its saved hash.</summary>+ [Theory]+ [InlineData(false)]+ [InlineData(true)]+ public void AStayedLostMarkerRoundTripsAndIsTheOnlyAcceptedOldHashDifference(bool gdd03)+ {+ var c = CaptureTests.Load(files =>+ {+ NoAttentionTests.Select(files, gdd03);+ files["map/units_1948.yaml"] = "units:\n- id: starter\n service: army\n side: israel\n status: draft\n strength: { value: 20, as_of: '1948-05-15' }\n anchors:\n - { place: Here, lon: 34.29, lat: 33.35, from: '1948-05-15', to: '1949-01-01' }\n";+ files["map/unit_anchor_hexes.yaml"] = "anchors:\n - { id: starter, anchor: 0, q: 0, r: 1 }\n";+ }, CaptureTests.AllTargets);+ var played = GameSession.New(c, 1, Mode.Historical);+ var result = played.Step(new Command[] { new Move(0, 1, 0), new ResolveCapture("town_a", SettlementControl.Raid) });+ Assert.Empty(result.Rejected);+ var lost = played.State.Settlements["town_a"];+ Assert.Equal(("", "", false), (lost.Owner, lost.State, lost.Fled));+ Assert.Equal(played.State.Date, lost.Since);+ Assert.Equal(played.State.Hash(), GameSession.Load(c, played.Save.Write(), out var warnings).State.Hash());+ Assert.Empty(warnings);++ string WithEnd(string text, string hash)+ {+ var lines = text.Split('\n');+ lines[lines.Length - 2] = "end " + hash;+ return string.Join("\n", lines);+ }+ var beforeMarkers = played.State.Clone(); beforeMarkers.Settlements.Remove("town_a");+ // Only an older save can be from before the markers. A save in the current schema always has them, so one without+ // them was edited: the damaged-save error (Codex review of 47da9b207). An older save of a valid schema for its+ // ruleset (gdd-0.1 wrote 3, gdd-0.3 wrote 4, whenever that is under the current schema) is the same game and loads.+ string text = played.Save.Write();+ int written = SaveGame.Parse(text).Version, older = gdd03 ? 4 : 3;+ string Header(string t, int v) => t.Replace(FormattableString.Invariant($"statecraft-save {written}\n"), FormattableString.Invariant($"statecraft-save {v}\n"));+ if (written >= SaveGame.SchemaVersion)+ {+ var current = Assert.Throws<SaveException>(() => GameSession.Load(c, WithEnd(text, beforeMarkers.Hash()), out _));+ Assert.Equal("The replay does not match the saved game: the save is damaged or was edited, or the game has a bug.", current.Message);+ }+ if (older < SaveGame.SchemaVersion)+ {+ var accepted = GameSession.Load(c, WithEnd(older < written ? Header(text, older) : text, beforeMarkers.Hash()), out warnings);+ Assert.Empty(warnings);+ Assert.Equal(played.State.Hash(), accepted.State.Hash());+ }++ var other = beforeMarkers.Clone(); other.Treasury += 1;+ var ex = Assert.Throws<SaveException>(() => GameSession.Load(c, WithEnd(played.Save.Write(), other.Hash()), out _));+ Assert.Equal("The replay does not match the saved game: the save is damaged or was edited, or the game has a bug.", ex.Message);+ }+[Fact]// R-ALT-009public void ARejoinedRoadRoundTripsThroughASave()diff --git a/sim/Statecraft.Sim/GameSession.cs b/sim/Statecraft.Sim/GameSession.csindex 10d73e1ca..d4cbedc1f 100644--- a/sim/Statecraft.Sim/GameSession.cs+++ b/sim/Statecraft.Sim/GameSession.cs@@ -108,7 +108,12 @@ namespace Statecraft.Sim// #2536: a game finished before the ending turn fired objective cards replays with those cards added, and only// them: the same game, so it loads as saved, with no warning, and shows its ending card(s).// Only an older save can be from before #2536: a current-schema save always has its ending cards (#2605 review).- if (session.State.Hash() != saved.FinalHash && !(saved.Version < SaveGame.SchemaVersion && OnlyEndingCardsAdded(c, session.State, saved.FinalHash)))+ // #2542: a save made before stayed losses left a marker replays with only those markers added. It is the same+ // game, so accept that exact same-content difference; every other replay mismatch keeps the existing handling.+ // Only an older save can be from before the markers: a current-schema save always has them, so one without them+ // was edited (Codex review of 47da9b207).+ if (session.State.Hash() != saved.FinalHash && !(saved.Version < SaveGame.SchemaVersion && OnlyEndingCardsAdded(c, session.State, saved.FinalHash))+ && !(saved.Version < SaveGame.SchemaVersion && sameContent && OnlyLostMarkersAdded(session.State, saved.FinalHash))){if (saved.Version < 3 && saved.Ruleset == SaveGame.GddRuleset)throw new SaveException(0, "This save was made with an earlier version of the game's rules.", SaveException.OlderRules);@@ -142,5 +147,20 @@ namespace Statecraft.Simbefore.PendingEvents.Clear();return before.Hash() == savedHash;}++ /// <summary>#2542: whether a replay differs from its saved final state only by ownerless, inhabited, stayed markers+ /// for places captured and later lost. Before this change those records were removed. Narrow by design: remove every+ /// record having exactly the new lost-marker shape, then require the saved hash to match.</summary>+ static bool OnlyLostMarkersAdded(GameState s, string savedHash)+ {+ var ids = s.Settlements.Where(kv => kv.Value.Owner == "" && kv.Value.State == ""+ && kv.Value.Since != default && !kv.Value.Depopulated && !kv.Value.Fled+ && kv.Value.Combatants == 0 && kv.Value.Buildings == "" && kv.Value.Turns == 0)+ .Select(kv => kv.Key).ToList();+ if (ids.Count == 0) return false;+ var before = s.Clone();+ foreach (var id in ids) before.Settlements.Remove(id);+ return before.Hash() == savedHash;+ }}}diff --git a/sim/Statecraft.Sim/SettlementControl.cs b/sim/Statecraft.Sim/SettlementControl.csindex 4e237a34e..ba1b1737f 100644--- a/sim/Statecraft.Sim/SettlementControl.cs+++ b/sim/Statecraft.Sim/SettlementControl.cs@@ -24,9 +24,9 @@ namespace Statecraft.Simvar enemyHeld = new HashSet<string>(c.RulesAt(s.Date).Mvp!.EnemyHeldLocalities, StringComparer.Ordinal);foreach (var t in c.SettlementTargets.Where(x => enemyHeld.Contains(x.Id)).OrderBy(x => x.Id, StringComparer.Ordinal)){- // An ownerless fled record (the place returned to enemy control) is no record here, so it can be taken again.+ // An ownerless, non-depopulated record marks a place returned to enemy control and can be taken again.if (Holder(s, t.Q, t.R) != Movement.PlayerSide- || (s.Settlements.TryGetValue(t.Id, out var old) && !(old.Owner == "" && old.Fled && !old.Depopulated))) continue;+ || (s.Settlements.TryGetValue(t.Id, out var old) && !(old.Owner == "" && !old.Depopulated))) continue;var fled = t.Residents == ContentLoader.Fled;s.Settlements[t.Id] = new SettlementControl(Movement.PlayerSide, AwaitingChoice, fled: fled);why.Add(new Cause("map", t.Id, 0, $"{c.SettlementNames[t.Id]} is captured: Israeli units hold it and no enemy unit is there. "@@ -38,8 +38,7 @@ namespace Statecraft.Sim/// Deport keeps that date in its ownerless record (#1327); every other field is preserved.</summary>internal static void Stamp(GameState s, DateTime next){- foreach (var id in s.Settlements.Where(x => x.Value.Since == default- && (x.Value.Owner == Movement.PlayerSide || x.Value.Depopulated || x.Value.Fled)).Select(x => x.Key).ToList())+ foreach (var id in s.Settlements.Where(x => x.Value.Since == default).Select(x => x.Key).ToList()){var x = s.Settlements[id];s.Settlements[id] = new SettlementControl(x.Owner, x.State, next, x.Depopulated, x.Combatants, x.Buildings, x.Turns, x.Fled);@@ -209,16 +208,16 @@ namespace Statecraft.Sim/// <summary>R-CTRL-010, Raid and withdraw (Q-RAID-1 (a)): the player's units on the place's hex, soldiers and halutzim/// alike, leave in id order, each to the first neighbouring hex in the fixed <see cref="Movement.Neighbours"/> order/// that is land, holds no enemy unit, is no enemy-held locality (R-MOVE-005) and has room for it (R-MOVE-003). Leaving- /// costs no movement points (the default proposed on #797). The record goes (a fled one stays ownerless, <see cref="Release"/>),+ /// costs no movement points (the default proposed on #797). The record becomes the ownerless marker (<see cref="Release"/>),/// so the place is under enemy control again at once, and its residents are unchanged (or fled at capture). Refused, the state untouched, when a unit has nowhere to go, unless- /// <paramref name="atTheEnd"/>: then that unit stays, the others leave and the record still goes.</summary>+ /// <paramref name="atTheEnd"/>: then that unit stays, the others leave and the ownerless marker remains.</summary>static CaptureRefusal? Withdraw(Content c, GameState s, string id, List<Cause> why, bool atTheEnd){var t = c.SettlementTargets.First(x => x.Id == id); // only a target gets a record (R-CTRL-004)var name = c.SettlementNames[id];var moved = new List<(Unit From, Unit To)>();if (MoveOut(c, s, t, name, atTheEnd, moved) is CaptureRefusal no) return no;- var residentsFled = s.Settlements[id].Fled; // snapshot before Release removes the record+ var residentsFled = s.Settlements[id].Fled; // snapshot before Release replaces the recordvar residents = Residents(s.Settlements[id]);Release(s, id);Withdrew(id, name, moved, why);@@ -235,13 +234,12 @@ namespace Statecraft.Sim/// <summary>What the player-facing lines say about the residents: unchanged for a stayed place, fled for a fled one.</summary>static string Residents(SettlementControl x) => x.Fled ? FledLine : "Its residents are unchanged";- /// <summary>R-CTRL-004, R-CTRL-010 (OWNER QUESTION 2 (b) on #799): a place returns to enemy control. A fled record stays- /// as an ownerless record with its capture date, the flight remembered; any other record goes.</summary>+ /// <summary>R-CTRL-004, R-CTRL-010: a place returns to enemy control. Its record stays ownerless with its capture date+ /// and the residents' flight state remembered, so a stayed loss remains distinguishable from a place never taken.</summary>static void Release(GameState s, string id){var x = s.Settlements[id];- if (x.Fled) s.Settlements[id] = new SettlementControl(since: x.Since, fled: true);- else s.Settlements.Remove(id);+ s.Settlements[id] = new SettlementControl(since: x.Since, fled: x.Fled);}/// <summary>R-CTRL-010's move: the units leave <paramref name="t"/>'s hex as <see cref="Withdraw"/> says, into@@ -342,7 +340,7 @@ namespace Statecraft.Sim/// <summary>R-CTRL-008 (owner, 18 October 2026 on #797, "Counts as Raid"), where resolver step 10 sits on the turn that/// reaches the game's end: every capture still awaiting the choice, in ordinal id order, resolves as Raid. A unit with- /// nowhere to go stays while the others leave, and the record goes all the same, since the game is over. It runs before objectives and score+ /// nowhere to go stays while the others leave, and the record becomes ownerless all the same, since the game is over. It runs before objectives and score/// (step 11) and changes neither, so it adds nothing to the score.</summary>internal static void EndPending(Content c, GameState s, List<Cause> why){@@ -355,7 +353,7 @@ namespace Statecraft.Sim/// <summary>Resolver step 10, the occupation timers, in ordinal id order (R-CTRL-011 to R-CTRL-013). An occupied place/// with no Israeli military unit left on its hex has been withdrawn from before the timer ended, which is a Raid- /// (Q-OCC-2 (a)): its record goes, so it is under enemy control again, its residents unchanged, and nothing is paid.+ /// (Q-OCC-2 (a)): its record becomes ownerless, so it is under enemy control again, its residents unchanged, and nothing is paid./// Every other occupation pays mvp.occupation_upkeep_per_turn (Q-OCC-1 (a)), the wait for EndOccupation included, and a/// running timer counts one turn down; at 0 the place awaits EndOccupation (Phase 6 PR 7). It draws nothing from the/// RNG.</summary>diff --git a/unity/Assets/Scripts/Map/MapRegions.cs b/unity/Assets/Scripts/Map/MapRegions.csindex fc1ced1db..a8bc7e5ad 100644--- a/unity/Assets/Scripts/Map/MapRegions.cs+++ b/unity/Assets/Scripts/Map/MapRegions.cs@@ -32,6 +32,7 @@ namespace Statecraft.Game.Map/// <summary>Who held which areas (null: the older drawing, sub-districts with the armistice zones over them).</summary>public readonly Control1948? Control;readonly Dictionary<string, RegionLayer> composed = new Dictionary<string, RegionLayer>();+ readonly Dictionary<string, RegionLayer> liveComposed = new Dictionary<string, RegionLayer>(StringComparer.Ordinal);RegionLayer? neutralSubdistricts;public MapRegions(Subdistricts1948 subdistricts, Armistice1949? armistice, Control1948? control = null, MapRegionNames? names = null)@@ -134,6 +135,29 @@ namespace Statecraft.Game.Mapreturn composed[key] = new RegionLayer(Subdistricts.Layer.Name + "+armistice_1949", hexes, styles);}+ /// <summary>The dated layer with live settlement ownership overlaid on settlement hexes only. The tuples are the+ /// displayed settlement hex and whether the player holds it. An overlay that does not change a colour returns the+ /// dated layer itself, preserving the normal no-op redraw path.</summary>+ public RegionLayer? LayerOn(DateTime date, IEnumerable<(int q, int r, bool player)> liveSettlements)+ {+ if (liveSettlements == null) throw new ArgumentNullException(nameof(liveSettlements));+ var historical = LayerOn(date);+ if (historical == null) return null;+ var overrides = liveSettlements.OrderBy(x => x.q).ThenBy(x => x.r).ThenBy(x => x.player).ToList();+ if (!overrides.Any(x => historical.StyleOf(historical.RegionOf(x.q, x.r))+ != (x.player ? BorderStyle.Primary : BorderStyle.Secondary))) return historical;+ var signature = string.Join(";", overrides.Select(x => FormattableString.Invariant($"{x.q},{x.r},{(x.player ? 1 : 0)}")));+ var key = historical.Name + ":live:" + signature;+ if (liveComposed.TryGetValue(key, out var cached)) return cached;+ var hexes = historical.Hexes.ToDictionary(h => h, h => historical.RegionOf(h.q, h.r));+ var styles = hexes.Values.Distinct().ToDictionary(id => id, id => historical.StyleOf(id));+ styles[Control1948.IsraelId] = BorderStyle.Primary;+ styles[Control1948.ArabId] = BorderStyle.Secondary;+ foreach (var x in overrides) if (hexes.ContainsKey((x.q, x.r)))+ hexes[(x.q, x.r)] = x.player ? Control1948.IsraelId : Control1948.ArabId;+ return liveComposed[key] = new RegionLayer(key, hexes, styles);+ }+bool? shownState; RegionLayer? drawn;/// <summary>Whether the last <see cref="Apply"/> drew a layer.</summary>public bool Shown => shownState == true;@@ -150,6 +174,17 @@ namespace Statecraft.Game.Mapdrawn = layer;}+ /// <summary>Draws the dated layer with live settlement ownership overlaid.</summary>+ public void Apply(DateTime date, IEnumerable<(int q, int r, bool player)> liveSettlements)+ {+ var layer = LayerOn(date, liveSettlements);+ if (shownState != null && ReferenceEquals(layer, drawn)) return;+ shownState = layer != null;+ if (layer != null) MapBorders.Use(layer);+ else if (drawn != null && MapBorders.Current == drawn) MapBorders.Use(null);+ drawn = layer;+ }+/// <summary>The fronts whose armistice line is shown on <paramref name="date"/>, and those that keep the Mandate/// layer for want of line data (only listed once some front's line is shown).</summary>public (IReadOnlyList<Armistice1949.Front> inForce, IReadOnlyList<Armistice1949.Front> noData) FrontsOn(DateTime date)diff --git a/unity/Assets/Scripts/UI/GameRoot.cs b/unity/Assets/Scripts/UI/GameRoot.csindex 040d5c1ed..c5f19b358 100644--- a/unity/Assets/Scripts/UI/GameRoot.cs+++ b/unity/Assets/Scripts/UI/GameRoot.cs@@ -441,7 +441,11 @@ namespace Statecraft.Game.UIvar layerLabel = root.Q<Label>("map-layer");Action onDate = () =>{- regions.Apply(bridge.State.Date);+ var live = bridge.State.Settlements.OrderBy(kv => kv.Key, StringComparer.Ordinal)+ .Join(bridge.Content.SettlementHexes, kv => kv.Key, h => h.Id,+ (kv, h) => (h.Q, h.R, player: SettlementControlView.PlayerHolds(kv.Value)))+ .Where(x => x.player != null).Select(x => (x.Q, x.R, x.player!.Value)).ToList();+ regions.Apply(bridge.State.Date, live);layerLabel.text = regions.ControlLabel(bridge.State.Date, k => text[k])?? regions.Label(bridge.State.Date, text.Format, text["ui.lang"] == UiLanguage.Hebrew);ShowLayerLabel();diff --git a/unity/Assets/Scripts/UI/InfoPanelPresenter.cs b/unity/Assets/Scripts/UI/InfoPanelPresenter.csindex fd971e49a..8e8276a55 100644--- a/unity/Assets/Scripts/UI/InfoPanelPresenter.cs+++ b/unity/Assets/Scripts/UI/InfoPanelPresenter.cs@@ -1,4 +1,5 @@#nullable enable+using System;using System.Collections.Generic;using System.Globalization;using System.Linq;@@ -677,7 +678,8 @@ namespace Statecraft.Game.UI/// <summary>The region lines for a hex on a date: its armistice zone (name, agreement, date) if one is in force, else/// its 1948 sub-district; then each armistice line in force through it. <paramref name="jerusalem"/>: the hex is the/// Jerusalem settlement's (see ControlText).</summary>- public static string RegionText(MapRegions regions, UiText text, int q, int r, System.DateTime date, bool jerusalem = false)+ public static string RegionText(MapRegions regions, UiText text, int q, int r, System.DateTime date, bool jerusalem = false,+ bool? livePlayerHolder = null){// Isolate a Hebrew date from the surrounding English fallback names: otherwise the row's// LTR paragraph can place its day before its year/month (the mixed-language #558 browser regression).@@ -688,9 +690,9 @@ namespace Statecraft.Game.UI}var parts = new List<string>();var zone = regions.ZoneAt(q, r, date);- var control = ControlText(regions, text, q, r, date, jerusalem);+ var control = ControlText(regions, text, q, r, date, jerusalem, livePlayerHolder);// a demilitarized zone is named by its own line below; the control line would only repeat "Demilitarized zone"- if (control != "" && !(zone != null && regions.Control?.At(q, r, date).side == Control1948.Side.Dmz)) parts.Add(control);+ if (control != "" && !(livePlayerHolder == null && zone != null && regions.Control?.At(q, r, date).side == Control1948.Side.Dmz)) parts.Add(control);// the sub-district only while the map draws the sub-district bands (before the first sourced line, or with no side data)var sub = regions.Subdistricts.ShowsOn(date) && regions.ControlPeriod(date) == null ? regions.Subdistricts.SubdistrictAt(q, r) : null;string N(string key, string english) => regions.Names.Pick(key, english, text["ui.lang"] == UiLanguage.Hebrew);@@ -710,8 +712,10 @@ namespace Statecraft.Game.UI/// Jerusalem also holds the Old City, so the data puts it on the Arab side from 11 June 1948; its panel names the/// Israeli-held West Jerusalem instead, and the map keeps its colour (#2039, owner ruling 2 Nov 2026: "Keep hexes, fix/// the panel").</summary>- public static string ControlText(MapRegions regions, UiText text, int q, int r, System.DateTime date, bool jerusalem = false)+ public static string ControlText(MapRegions regions, UiText text, int q, int r, System.DateTime date, bool jerusalem = false,+ bool? livePlayerHolder = null){+ if (livePlayerHolder != null) return text[livePlayerHolder.Value ? "info.control_israel" : "info.control.enemy_held"];var p = regions.ControlPeriod(date);if (p == null || regions.Control == null) return "";var (side, holder) = regions.Control.At(q, r, date);@@ -964,8 +968,15 @@ namespace Statecraft.Game.UIsubtitle.text = hex == null ? "" : text.Format("info.hex", text["info.biome." + hex.Biome], hex.ElevM); // no debug coordinates in player text (playtest 2, P2-6)// The armistice zone in force, else the sub-district on 15 May 1948, and any armistice line in force through the// hex, each with its agreement (true lines drawn to the nearest hex edge: the owner's ruling).- region.text = regions == null ? "" : RegionText(regions, text, q, r, s.Date, c.SettlementHexes.Any(x => x.Q == q && x.R == r && x.Id == "jerusalem"));+ var livePlaces = c.SettlementHexes.Where(x => x.Q == q && x.R == r && s.Settlements.ContainsKey(x.Id))+ .OrderBy(x => x.Id, StringComparer.Ordinal).Select(x => (hex: x, record: s.Settlements[x.Id])).ToList();+ var liveHolder = livePlaces.Select(x => SettlementControlView.PlayerHolds(x.record)).FirstOrDefault(x => x != null);+ region.text = regions == null ? "" : RegionText(regions, text, q, r, s.Date,+ c.SettlementHexes.Any(x => x.Q == q && x.R == r && x.Id == "jerusalem"), liveHolder);settlements.text = owned.Count > 0 ? text.Format("info.owned", string.Join(", ", owned)) : "";+ foreach (var x in livePlaces)+ if (SettlementControlView.PanelText(text, TownName(x.hex.Id), x.record) is string detail)+ settlements.text += (settlements.text == "" ? "" : "\n") + detail;// A town in a water hex is drawn on its nearest land hex (Tiberias, in the lake, on the 70 m hex): one line says// so, so this hex's elevation does not read as the town's (#204).if (townHex != null)diff --git a/unity/Assets/Scripts/UI/SettlementControlView.cs b/unity/Assets/Scripts/UI/SettlementControlView.csindex 9627db61c..67426f72f 100644--- a/unity/Assets/Scripts/UI/SettlementControlView.cs+++ b/unity/Assets/Scripts/UI/SettlementControlView.cs@@ -10,15 +10,26 @@ namespace Statecraft.Game.UI{if (record == null) return null;if (record.Depopulated) return "depopulated";+ if (record.Owner == "") return "lost";return record.State switch{SettlementControl.AwaitingChoice => "awaiting_choice",SettlementControl.Occupied => "occupied",SettlementControl.AwaitingEnd => "awaiting_end",+ SettlementControl.Annexed => "annexed",_ => null,};}+ /// <summary>The live holder represented by a settlement-control record: true for Israel, false for the enemy, and+ /// null when there is no record (or a future record whose owner this UI does not understand).</summary>+ public static bool? PlayerHolds(SettlementControl? record) => record?.Owner switch+ {+ Movement.PlayerSide => true,+ "" => false,+ _ => null,+ };+public static string? MapText(UiText text, SettlementControl? record) =>Key(record) is string key ? text["map.control." + key] : null;diff --git a/unity/Assets/Tests/EditMode/BuildGateTests.cs b/unity/Assets/Tests/EditMode/BuildGateTests.csindex 800afdf15..a92ba8eb3 100644--- a/unity/Assets/Tests/EditMode/BuildGateTests.cs+++ b/unity/Assets/Tests/EditMode/BuildGateTests.cs@@ -107,8 +107,8 @@ public class BuildGateTestspublic void TheShippedReviewManifestCoversTheWholeSettlementControlSurface() // R-GATE-002{var review = ParseSettlementReview(File.ReadAllText(UiPaths.SettlementControlStringsReview), UiPaths.SettlementControlStringsReview);- Assert.AreEqual("sensitivity-reviewed", SettlementReview.GetProperty("Status")!.GetValue(review),- "the owner signed off all 42 strings themselves (dbc70439, 26 October 2026); an AI-assisted change never sets this");+ Assert.AreEqual("pending", SettlementReview.GetProperty("Status")!.GetValue(review),+ "#2542 adds agent-drafted English and Hebrew control strings; native and sensitivity review are pending");var rows = ((System.Collections.IEnumerable)SettlementReview.GetProperty("Strings")!.GetValue(review)!).Cast<object>();var rowType = SettlementReview.GetNestedType("Row")!;var keys = rows.Select(x => (string)rowType.GetProperty("Key")!.GetValue(x)!).ToArray();@@ -124,7 +124,9 @@ public class BuildGateTests"capture.refusal.no_one_to_deport", "capture.refusal.already_city", "capture.refusal.not_awaiting","capture.refusal.unknown_outcome","map.control.awaiting_choice", "map.control.occupied", "map.control.awaiting_end", "map.control.depopulated",+ "map.control.annexed", "map.control.lost","info.control.awaiting_choice", "info.control.occupied", "info.control.awaiting_end", "info.control.depopulated",+ "info.control.annexed", "info.control.lost", "info.control.enemy_held","hud.standing_displaced_places",}, keys);// A settlement-control key added to either strings file later (U6's dialog, #799's annex words) must join the manifest.diff --git a/unity/Assets/Tests/EditMode/CaptureDialogTests.cs b/unity/Assets/Tests/EditMode/CaptureDialogTests.csindex 48f103800..006331639 100644--- a/unity/Assets/Tests/EditMode/CaptureDialogTests.cs+++ b/unity/Assets/Tests/EditMode/CaptureDialogTests.cs@@ -99,6 +99,17 @@ public class CaptureDialogTestsreturn g;}+ /// <summary>#2542: a place whose control ended (Raid, Withdraw) keeps an ownerless record with its capture date, so a stayed+ /// loss stays distinguishable from a place never taken (SettlementControl.Release, R-CTRL-004, R-CTRL-010).</summary>+ static void AssertStayedLost(GameState s, string id, System.DateTime since, string why)+ {+ Assert.IsTrue(s.Settlements.TryGetValue(id, out var x), why + ": the record stays as the ownerless marker");+ Assert.AreEqual("", x!.Owner, why + ": no owner");+ Assert.AreEqual("", x.State, why + ": no control state");+ Assert.AreEqual(since, x.Since, why + ": the capture date is kept");+ Assert.IsFalse(x.Depopulated, why + ": not depopulated");+ }+/// <summary>The settlements' Hebrew names as GameRoot hands them over (the map's parse of settlements_1948.yaml).</summary>static IReadOnlyDictionary<string, string> NamesHe() =>Statecraft.Game.Map.SettlementPlacer.Parse(File.ReadAllText(Path.Combine(Paths.Content, "map", "settlements_1948.yaml"))).ToDictionary(s => s.Id, s => s.NameHe);@@ -450,9 +461,11 @@ public class CaptureDialogTestsAssert.IsNull(r.Dialog.Shown, "every capture answered");Assert.IsFalse(r.Shows("capture-card"));Assert.AreSame(r.Root.Q<Button>("end-turn"), r.Focused, "answered from the keyboard, the focus goes to End turn");+ var lodSince = r.Bridge.State.Settlements["lod"].Since; var ramlaSince = r.Bridge.State.Settlements["ramla"].Since;var result = r.Bridge.EndTurn();Assert.IsEmpty(result.Rejected.Where(x => x.Command is ResolveCapture), "the sim takes both");- Assert.IsFalse(r.Bridge.State.Settlements.ContainsKey("lod") || r.Bridge.State.Settlements.ContainsKey("ramla"), "Raid ended both records");+ AssertStayedLost(r.Bridge.State, "lod", lodSince, "Raid ended Lydda's control");+ AssertStayedLost(r.Bridge.State, "ramla", ramlaSince, "Raid ended Ramle's control");}/// <summary>#2023: exactly one more decision waiting is the singular line in both languages (event.more_one, the pick@@ -731,10 +744,11 @@ public class CaptureDialogTestsyield return Frames(3);Assert.IsNull(r.Dialog.Shown);Assert.AreSame(r.Root.Q<Button>("end-turn"), r.Focused, "answered from the keyboard, the focus goes to End turn");+ var since = r.Bridge.State.Settlements["ramla"].Since;var result = r.Bridge.EndTurn();Assert.IsEmpty(result.Rejected.Where(x => x.Command is EndOccupation), string.Join("; ", result.Rejected.Select(x => x.Reason)));Assert.AreEqual(SettlementControl.Annexed, r.Bridge.State.Settlements["lod"].State, "End turn annexed Lydda (R-CTRL-016)");- Assert.IsFalse(r.Bridge.State.Settlements.ContainsKey("ramla"), "and withdrew from Ramle (R-CTRL-010)");+ AssertStayedLost(r.Bridge.State, "ramla", since, "and withdrew from Ramle (R-CTRL-010)");}/// <summary>Plan PR 10, AQueuedEndDecisionIsNotShownAgain: a place with an EndOccupation queued has had its choice; a newdiff --git a/unity/Assets/Tests/EditMode/ControlTests.cs b/unity/Assets/Tests/EditMode/ControlTests.csindex 849dc2812..4ec522c7a 100644--- a/unity/Assets/Tests/EditMode/ControlTests.cs+++ b/unity/Assets/Tests/EditMode/ControlTests.cs@@ -169,6 +169,25 @@ public class ControlTestsAssert.AreNotEqual(Control1948.Side.Israel, c.At(YadMordechaiHex.q, YadMordechaiHex.r, Truce1).side, "fallen on 24 May");}+ [Test]+ public void LiveSettlementControlOverridesOnlyEffectiveHistoricalDifferences()+ {+ var m = Regions();+ var historical = m.LayerOn(Start)!;+ Assert.AreSame(historical, m.LayerOn(Start, Array.Empty<(int q, int r, bool player)>()));+ Assert.AreSame(historical, m.LayerOn(Start, new[] { (YadMordechaiHex.q, YadMordechaiHex.r, true) }),+ "a live holder matching the dated colour is a no-op");++ var captured = m.LayerOn(Start, new[] { (AcreHex.q, AcreHex.r, true) })!;+ Assert.AreEqual(BorderStyle.Primary, captured.StyleOf(captured.RegionOf(AcreHex.q, AcreHex.r)));+ Assert.AreEqual(historical.RegionOf(JerusalemHex.q, JerusalemHex.r), captured.RegionOf(JerusalemHex.q, JerusalemHex.r));+ Assert.AreEqual(Control1948.Side.Contested, m.Control!.At(AcreHex.q, AcreHex.r, Start).side,+ "the immutable dated source is unchanged");++ var lost = m.LayerOn(Start, new[] { (YadMordechaiHex.q, YadMordechaiHex.r, false) })!;+ Assert.AreEqual(BorderStyle.Secondary, lost.StyleOf(lost.RegionOf(YadMordechaiHex.q, YadMordechaiHex.r)));+ }+/// <summary>Kept for a side file whose first period starts later: before it the sub-districts are grey, never blue.</summary>[Test]public void BeforeAFirstPeriodTheSubdistrictsAreGreyNotBlue()@@ -333,6 +352,26 @@ public class ControlTestsStringAssert.Contains("18 July 1948", label.text);}+ [Test]+ public void ANormalGameRedrawsLiveSettlementControlWithoutChangingDate()+ {+ EditorSceneManager.OpenScene("Assets/Map.unity", OpenSceneMode.Single);+ Object.FindFirstObjectByType<MapScene>().Build(Inputs.Map);+ var root = Object.FindFirstObjectByType<GameRoot>();+ root.Store = new SaveStore(saveDir);+ root.Begin(Inputs, 0);+ var acre = Inputs.Content.SettlementHexes.Single(x => x.Id == "acre");+ var captured = GameSession.New(Inputs.Content, GoldenRun.Seed, Mode.Historical);+ captured.State.Settlements["acre"] = new SettlementControl(Movement.PlayerSide, SettlementControl.AwaitingChoice, captured.State.Date);+ root.Bridge!.Replace(captured);+ Assert.AreEqual(BorderStyle.Primary, MapBorders.Current!.StyleOf(MapBorders.Current.RegionOf(acre.Q, acre.R)));++ var lost = GameSession.New(Inputs.Content, GoldenRun.Seed, Mode.Historical);+ lost.State.Settlements["acre"] = new SettlementControl(since: lost.State.Date);+ root.Bridge!.Replace(lost);+ Assert.AreEqual(BorderStyle.Secondary, MapBorders.Current!.StyleOf(MapBorders.Current.RegionOf(acre.Q, acre.R)));+ }+[Test]public void TheWebGLBuildShipsTheFileAndReadsIt(){diff --git a/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs b/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.csindex 94fe4b7e0..31f0c1976 100644--- a/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs+++ b/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs@@ -575,6 +575,39 @@ public class InfoPanelLayoutTests}}+ [Test]+ public void ASelectedSettlementShowsTheLiveHolderThenEveryStateDetailInEnglishAndHebrew()+ {+ var names = Names();+ var namesHe = SettlementPlacer.Parse(MapFile(SettlementPlacer.DefaultFileName)).ToDictionary(t => t.Id, t => t.NameHe);+ var acre = C.SettlementHexes.Single(s => s.Id == "acre");+ var he = UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml");+ var states = new[]+ {+ new SettlementControl(Movement.PlayerSide, SettlementControl.AwaitingChoice, new System.DateTime(1948, 5, 20)),+ new SettlementControl(Movement.PlayerSide, SettlementControl.Occupied, new System.DateTime(1948, 5, 20), turns: 2),+ new SettlementControl(Movement.PlayerSide, SettlementControl.AwaitingEnd, new System.DateTime(1948, 5, 20)),+ new SettlementControl(Movement.PlayerSide, SettlementControl.Annexed, new System.DateTime(1948, 5, 20)),+ new SettlementControl(since: new System.DateTime(1948, 5, 20), depopulated: true),+ new SettlementControl(since: new System.DateTime(1948, 5, 20)),+ };+ foreach (var text in new[] { Text, he })+ foreach (var record in states)+ {+ using var ui = new UiTestKit();+ var game = GameSession.New(C, GoldenRun.Seed, Mode.Historical);+ game.State.Settlements["acre"] = record;+ var info = new InfoPanelPresenter(ui.Root, new SimBridge(game, text), text, names, regions: Regions(), townNamesHe: namesHe);+ info.Show(acre.Q, acre.R);+ var holder = SettlementControlView.PlayerHolds(record) == true ? text["info.control_israel"] : text["info.control.enemy_held"];+ Assert.AreEqual(holder, ui.Q<Label>("info-region").text.Split('\n')[0], text["ui.lang"] + ": live holder first");+ var place = text["ui.lang"] == UiLanguage.Hebrew ? namesHe["acre"]! : names["acre"];+ StringAssert.Contains(SettlementControlView.PanelText(text, place, record)!, ui.Q<Label>("info-settlements").text,+ text["ui.lang"] + ": state detail");+ info.Dispose();+ }+ }+/// <summary>#204 drift guard: the note says "water hex" because a town's own hex (TownHex) differs from its drawn hex/// only where hexgrid.settlement_hex moved it off a water hex. Every such town's own hex is on the map and not land, and/// there is at least one (Tiberias), so the guard cannot pass on an empty list.</summary>diff --git a/unity/Assets/Tests/EditMode/SettlementControlViewTests.cs b/unity/Assets/Tests/EditMode/SettlementControlViewTests.csindex eae6e7566..f942d9ac4 100644--- a/unity/Assets/Tests/EditMode/SettlementControlViewTests.cs+++ b/unity/Assets/Tests/EditMode/SettlementControlViewTests.cs@@ -14,6 +14,7 @@ public class SettlementControlViewTests[TestCase(SettlementControl.AwaitingChoice, false, "awaiting_choice")][TestCase(SettlementControl.Occupied, false, "occupied")][TestCase(SettlementControl.AwaitingEnd, false, "awaiting_end")]+ [TestCase(SettlementControl.Annexed, false, "annexed")][TestCase("", true, "depopulated")]public void EveryRecordOnMainHasOneView(string state, bool depopulated, string expected){@@ -23,6 +24,16 @@ public class SettlementControlViewTestsAssert.AreEqual(expected, SettlementControlView.Key(record));}+ [Test]+ public void AStayedLostMarkerHasAnEnemyHolderAndLostView()+ {+ var lost = new SettlementControl(since: new System.DateTime(1948, 6, 1));+ Assert.AreEqual(false, SettlementControlView.PlayerHolds(lost));+ Assert.AreEqual("lost", SettlementControlView.Key(lost));+ Assert.AreEqual(true, SettlementControlView.PlayerHolds(new SettlementControl("israel", SettlementControl.Annexed)));+ Assert.IsNull(SettlementControlView.PlayerHolds(null));+ }+[Test]public void NoRecordOrAnUnknownStateHasNoView(){@@ -56,7 +67,9 @@ public class SettlementControlViewTestsvar keys = new[]{"map.control.awaiting_choice", "map.control.occupied", "map.control.awaiting_end", "map.control.depopulated",+ "map.control.annexed", "map.control.lost","info.control.awaiting_choice", "info.control.occupied", "info.control.awaiting_end", "info.control.depopulated",+ "info.control.annexed", "info.control.lost", "info.control.enemy_held","hud.standing_displaced_places",};foreach (var key in keys)diff --git a/unity/Assets/UI/settlement-control-strings-review.yaml b/unity/Assets/UI/settlement-control-strings-review.yamlindex ef4899814..0759b0ec8 100644--- a/unity/Assets/UI/settlement-control-strings-review.yaml+++ b/unity/Assets/UI/settlement-control-strings-review.yaml@@ -1,5 +1,5 @@# R-GATE-002. An AI-assisted change must not set this to sensitivity-reviewed.-status: sensitivity-reviewed+status: pendingstrings:- { key: capture.intro, en: "Israeli units hold {0}, and no enemy unit is there. Choose what happens next. Your choice takes effect at End turn; until you choose, the units stay.", he: "כוחות ישראליים מחזיקים ב{0}, ואין שם כוחות אויב. יש לבחור מה יקרה עכשיו. הבחירה תיכנס לתוקף בסיום התור; עד שתיבחר אפשרות, הכוחות נשארים במקום." }- { key: capture.option.raid, en: "Raid and withdraw", he: "פשיטה ונסיגה" }@@ -38,8 +38,13 @@ strings:- { key: map.control.occupied, en: "Occupied", he: "מוחזק" }- { key: map.control.awaiting_end, en: "Occupation period over", he: "תקופת ההחזקה הסתיימה" }- { key: map.control.depopulated, en: "Depopulated", he: "מרוקן מתושביו" }+ - { key: map.control.annexed, en: "Annexed", he: "מסופח" }+ - { key: map.control.lost, en: "Enemy-held", he: "בשליטת האויב" }- { key: info.control.awaiting_choice, en: "{0}: captured, decision pending", he: "{0}: נכבש, החלטה ממתינה" }- { key: info.control.occupied, en: "{0}: occupied, turns left: {1}", he: "{0}: מוחזק, תורות שנותרו: {1}" }- { key: info.control.awaiting_end, en: "{0}: occupation period over, decision pending", he: "{0}: תקופת ההחזקה הסתיימה, החלטה ממתינה" }- { key: info.control.depopulated, en: "{0}: residents displaced, place depopulated", he: "{0}: התושבים נעקרו ממקומם, המקום מרוקן מתושביו" }+ - { key: info.control.annexed, en: "{0}: annexed", he: "{0}: סופח" }+ - { key: info.control.lost, en: "{0}: lost, enemy-held", he: "{0}: אבד, בשליטת האויב" }+ - { key: info.control.enemy_held, en: "Held by enemy forces", he: "בשליטת כוחות האויב" }- { key: hud.standing_displaced_places, en: "Places depopulated by Deport: {0}", he: "מקומות שרוקנו מתושביהם בעקבות גירוש: {0}" }diff --git a/unity/Assets/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yamlindex 204f8e5cb..a32a52991 100644--- a/unity/Assets/UI/strings.en.yaml+++ b/unity/Assets/UI/strings.en.yaml@@ -313,10 +313,15 @@ map.control.awaiting_choice: "Decision pending"map.control.occupied: "Occupied"map.control.awaiting_end: "Occupation period over"map.control.depopulated: "Depopulated"+map.control.annexed: "Annexed"+map.control.lost: "Enemy-held"info.control.awaiting_choice: "{0}: captured, decision pending"info.control.occupied: "{0}: occupied, turns left: {1}"info.control.awaiting_end: "{0}: occupation period over, decision pending"info.control.depopulated: "{0}: residents displaced, place depopulated"+info.control.annexed: "{0}: annexed"+info.control.lost: "{0}: lost, enemy-held"+info.control.enemy_held: "Held by enemy forces"hud.standing_displaced_places: "Places depopulated by Deport: {0}"start.listen: "Play the recording"start.stop: "Stop the recording"diff --git a/unity/Assets/UI/strings.he.yaml b/unity/Assets/UI/strings.he.yamlindex 76ec484e4..db3cb3520 100644--- a/unity/Assets/UI/strings.he.yaml+++ b/unity/Assets/UI/strings.he.yaml@@ -351,10 +351,15 @@ map.control.awaiting_choice: "החלטה ממתינה"map.control.occupied: "מוחזק"map.control.awaiting_end: "תקופת ההחזקה הסתיימה"map.control.depopulated: "מרוקן מתושביו"+map.control.annexed: "מסופח"+map.control.lost: "בשליטת האויב"info.control.awaiting_choice: "{0}: נכבש, החלטה ממתינה"info.control.occupied: "{0}: מוחזק, תורות שנותרו: {1}"info.control.awaiting_end: "{0}: תקופת ההחזקה הסתיימה, החלטה ממתינה"info.control.depopulated: "{0}: התושבים נעקרו ממקומם, המקום מרוקן מתושביו"+info.control.annexed: "{0}: סופח"+info.control.lost: "{0}: אבד, בשליטת האויב"+info.control.enemy_held: "בשליטת כוחות האויב"hud.standing_displaced_places: "מקומות שרוקנו מתושביהם בעקבות גירוש: {0}"# [NATIVE REVIEW REQUIRED] native and owner review pending.start.listen: "השמעת ההקלטה"