A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Loader: refuse a designated site on a settlement target's hex (#2804 item 2) (#2861)
Beri43da8fc013c3
diff --git a/changelog.d/2804-target-sites.md b/changelog.d/2804-target-sites.mdnew file mode 100644index 000000000..45ce89e7a--- /dev/null+++ b/changelog.d/2804-target-sites.md@@ -0,0 +1,5 @@+### Fixed++- The content loader now refuses a designated site on a settlement target's hex, as it already did on a 1948+ settlement's hex. Ramla's target (-3, 24) is not a settlement's hex, so a site there would have loaded and stayed+ open to pioneer work after Ramla was depopulated. No shipped site is there, so nothing changes in play.diff --git a/docs/rules/mvp.md b/docs/rules/mvp.mdindex 7b5cc5633..64684ab6a 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -72,7 +72,7 @@ R-CTRL-018: Deport (impact plan section 4.1; owner ruling 1, "honest cost, no reR-CTRL-019: The residents (Q-DEP-2 (a), every resident the state holds; Q-DEP-3 (a), a count only, with no destination on the board): a Deport adds 1 to `DisplacedByPlayer`, a count of places, not people (Q-CAP-2 (b)), written to the hash as `displaced=` only when non-zero. They are outside the player's control: never refugee units, civilians, cohorts, units, prisoners, labour, housing occupants or score.-R-CTRL-020: A depopulated place (impact plan section 4.1 item 4; Q-DEP-7 (c); Q-SENS-2 (c)). Deport leaves the place's record with its capture date and `depopulated=1` only: no owner, state or timer. It stays on `mvp.enemy_held_localities`, so the player's units cannot enter it (R-MOVE-005) and it is never captured again, as a raided place is for the enemy. It adds no housing, jobs, Food, Money, Arms or score, and counts towards no objective. With no timer, resolver step 10 neither counts it down nor charges upkeep for it. No city project may be started on its hex (refused with the reason kind `depopulated`), and no corridor segment through it (this stops new starts; one already under way there is not cancelled); no designated site can be on a 1948 settlement's hex at all, and no event effect can name a place.+R-CTRL-020: A depopulated place (impact plan section 4.1 item 4; Q-DEP-7 (c); Q-SENS-2 (c)). Deport leaves the place's record with its capture date and `depopulated=1` only: no owner, state or timer. It stays on `mvp.enemy_held_localities`, so the player's units cannot enter it (R-MOVE-005) and it is never captured again, as a raided place is for the enemy. It adds no housing, jobs, Food, Money, Arms or score, and counts towards no objective. With no timer, resolver step 10 neither counts it down nor charges upkeep for it. No city project may be started on its hex (refused with the reason kind `depopulated`), and no corridor segment through it (this stops new starts; one already under way there is not cancelled); no designated site can be on a 1948 settlement's hex or a settlement target's hex at all (#2804), and no event effect can name a place.R-CTRL-021: Buildings (D-F3; Q-DEP-4 (a)): deportation and razing are separate rules, and there is no razing option in the MVP. The record's buildings stay at their default, and a capture offers only Raid, Occupy and Deport.diff --git a/sim/Statecraft.Sim.Tests/SitesContentTests.cs b/sim/Statecraft.Sim.Tests/SitesContentTests.csindex 5ceea0466..f052db448 100644--- a/sim/Statecraft.Sim.Tests/SitesContentTests.cs+++ b/sim/Statecraft.Sim.Tests/SitesContentTests.cs@@ -69,6 +69,27 @@ public class SitesContentTestsAssert.Contains((site.Q, site.R), lineHexes);}+ /// <summary>R-CTRL-020 (#2804): a depopulated place closes its target's hex, and Ramla's target (-3, 24) is not a+ /// settlement's hex (ContentLoader.TargetOnANeighbour), so the site guard refuses a site on any target's hex too.</summary>+ [Fact]+ public void ASiteOnASettlementTargetsHexFailsLoad()+ {+ var root = RealContentTests.ContentRoot();+ var events = Directory.GetFiles(Path.Combine(root, "events"), "*.yaml").Select(f => "events/" + Path.GetFileName(f)).ToList();+ const string mefalsim = " q: -11\n r: 31\n";+ Assert.Contains(mefalsim, File.ReadAllText(Path.Combine(root, "sites.yaml")));+ var ex = Assert.Throws<ContentException>(() => ContentLoader.Load(rel =>+ {+ var path = Path.Combine(root, rel);+ if (!File.Exists(path)) return null;+ var text = File.ReadAllText(path);+ return rel == "sites.yaml" ? text.Replace(mefalsim, " q: -3\n r: 24\n") : text;+ }, events));+ Assert.Equal("sites.yaml", ex.File);+ Assert.Equal("sites[mefalsim].q", ex.Field);+ Assert.Contains("hex q=-3 r=24 is the settlement target ramla", ex.Message);+ }+/// <summary>R-SITE-004, Q-SITE-1 and Q-SITE-2 (owner, 17 October 2026, #782: "take all of the plan's recommendations"): the/// MVP's yishuv sites are the four of the settlements note whose founding day two sources agree on (criteria 1, 2 and 4 of/// Task 5.0). Each is founded inside the MVP's years and cites at least two sources with a checked date. Kiryat Shmona anddiff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.csindex b189df0ed..44b7ad20c 100644--- a/sim/Statecraft.Sim/ContentLoader.cs+++ b/sim/Statecraft.Sim/ContentLoader.cs@@ -1877,9 +1877,9 @@ namespace Statecraft.Simstatic readonly string[] SiteKinds = { Projects.YishuvKind, "field", "swamp", "military_camp", "hakhshara" };static readonly string[] CampKinds = { "military_camp", "hakhshara" };- /// <summary>The designated sites (sites.yaml, Phase 1 PR 5): sourced facts on a land hex that holds no 1948 settlement,- /// founded inside the MVP's years (D-B1). The armistice line hexes are not checked: that file is display only, and a- /// site may sit on a line hex (#378, question 2).</summary>+ /// <summary>The designated sites (sites.yaml, Phase 1 PR 5): sourced facts on a land hex that holds no 1948 settlement+ /// and no settlement target, founded inside the MVP's years (D-B1). The armistice line hexes are not checked: that file+ /// is display only, and a site may sit on a line hex (#378, question 2).</summary>static void ValidateSites(Content c){const string sf = "sites.yaml";@@ -1898,6 +1898,11 @@ namespace Statecraft.Simvar settled = c.SettlementHexes.FirstOrDefault(h => h.Q == x.Q && h.R == x.R);if (settled != null)throw new ContentException(sf, at + ".q", FormattableString.Invariant($"hex q={x.Q} r={x.R} holds the 1948 settlement {settled.Id} ({SettlementHexesFileName})"));+ // R-CTRL-020 (#2804): a depopulated place closes its target's hex, which for Ramla (TargetOnANeighbour) is not a+ // settlement's hex, and pioneer work never asks DepopulatedAt; so no site may stand on a target's hex either.+ var target = c.SettlementTargets.FirstOrDefault(t => t.Q == x.Q && t.R == x.R);+ if (target != null)+ throw new ContentException(sf, at + ".q", FormattableString.Invariant($"hex q={x.Q} r={x.R} is the settlement target {target.Id} ({SettlementTargetsFileName})"));if (x.Kinds.Count == 0) throw new ContentException(sf, at + ".kinds", "required: one or more of " + string.Join(", ", SiteKinds));foreach (var k in x.Kinds)if (!SiteKinds.Contains(k)) throw new ContentException(sf, at + ".kinds", $"unknown kind '{k}' ({string.Join(", ", SiteKinds)})");