Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

Loader: pin Ramla's capture hex to (-3, 24) (#2804 item 1) (#2860)

Beri9b93bdc3b429
diff --git a/changelog.d/2804-ramla-target.md b/changelog.d/2804-ramla-target.md
new file mode 100644
index 000000000..04c9ed19a
--- /dev/null
+++ b/changelog.d/2804-ramla-target.md
@@ -0,0 +1,4 @@
+### Fixed
+
+- The content loader now refuses a Ramla capture hex other than (-3, 24), the hex R-CTRL-001 names (the neighbour nearest Ramla's point; owner on #1796). Before, any land
+ neighbour of Ramla's own hex loaded. The shipped list already uses (-3, 24), so nothing changes in play.
diff --git a/sim/Statecraft.Sim.Tests/ContentLoaderTests.cs b/sim/Statecraft.Sim.Tests/ContentLoaderTests.cs
index a76e9c108..fabb466ce 100644
--- a/sim/Statecraft.Sim.Tests/ContentLoaderTests.cs
+++ b/sim/Statecraft.Sim.Tests/ContentLoaderTests.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using Statecraft.Sim;
public class ContentLoaderTests
@@ -55,6 +56,27 @@ targets:
Assert.Contains(message, ex.Message);
}
+ // R-CTRL-001 (#2804): Ramla's target is (-3, 24), the owner's ruling on #1796, so another land neighbour of its hex
+ // (-4, 24) is refused, not only a hex that is no neighbour at all.
+ [Fact]
+ public void RamlasTargetIsTheHexTheRuleNames()
+ {
+ var dir = RealContentTests.ContentRoot();
+ var events = Directory.GetFiles(Path.Combine(dir, "events"), "*.yaml").Select(f => "events/" + Path.GetFileName(f)).ToList();
+ const string ruled = " q: -3\n r: 24\n";
+ Assert.Contains(ruled, File.ReadAllText(Path.Combine(dir, ContentLoader.SettlementTargetsFileName)));
+ var ex = Assert.Throws<ContentException>(() => ContentLoader.Load(rel =>
+ {
+ var path = Path.Combine(dir, rel);
+ if (!File.Exists(path)) return null;
+ var text = File.ReadAllText(path);
+ return rel == ContentLoader.SettlementTargetsFileName ? text.Replace(ruled, " q: -4\n r: 25\n") : text;
+ }, events));
+ Assert.Equal(ContentLoader.SettlementTargetsFileName, ex.File);
+ Assert.Equal("targets[ramla].q", ex.Field);
+ Assert.Contains("is not q=-3 r=24", ex.Message);
+ }
+
// R-CTRL-016 (Q-ANNEX-1; OWNER QUESTION 1 (a) on #799): a stayed row loads with its annexation values.
[Fact]
public void AStayedTargetLoadsWithItsAnnexationValues()
diff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.cs
index caaf07b38..b189df0ed 100644
--- a/sim/Statecraft.Sim/ContentLoader.cs
+++ b/sim/Statecraft.Sim/ContentLoader.cs
@@ -2052,8 +2052,9 @@ namespace Statecraft.Sim
/// <summary>Targets whose capture hex is a neighbour of their settlement's hex, not that hex (owner on #1796, 26 October
/// 2026, "Contested + move target"): at 4.4 km (#1183) Ramla shares (-4, 24) with Rehovot, so a unit on Rehovot's hex
- /// would capture Ramla. Its target is the neighbour nearest Ramla's point, cited in settlement_targets.yaml.</summary>
- internal static readonly HashSet<string> TargetOnANeighbour = new HashSet<string>(StringComparer.Ordinal) { "ramla" };
+ /// would capture Ramla. Its target is the neighbour nearest Ramla's point, cited in settlement_targets.yaml.
+ /// The ruling names the hex, so the loader pins it (#2804): another neighbour is a load error too.</summary>
+ internal static readonly Dictionary<string, (int Q, int R)> TargetOnANeighbour = new Dictionary<string, (int Q, int R)>(StringComparer.Ordinal) { ["ramla"] = (-3, 24) };
/// <summary>R-CTRL-001 (Q-TGT-1 (a)): every target is an arab_town row of settlements_1948.yaml on a land hex that is
/// its own hex in settlement_hexes.yaml (capture reads the target's hex, movement the settlement's), or for a
@@ -2070,8 +2071,10 @@ namespace Statecraft.Sim
var hex = c.HexAt(x.Q, x.R);
if (hex == null || !hex.Land)
throw new ContentException(SettlementTargetsFileName, at + ".q", FormattableString.Invariant($"hex q={x.Q} r={x.R} is not a land hex in {HexesFile}"));
- if (TargetOnANeighbour.Contains(x.Id))
+ if (TargetOnANeighbour.TryGetValue(x.Id, out var ruled))
{
+ if ((x.Q, x.R) != ruled)
+ throw new ContentException(SettlementTargetsFileName, at + ".q", FormattableString.Invariant($"hex q={x.Q} r={x.R} is not q={ruled.Q} r={ruled.R}, the hex R-CTRL-001 names for {x.Id} (the neighbour nearest its point; owner on #1796)"));
if (!c.SettlementHexes.Any(h => h.Id == x.Id && Movement.Neighbours.Any(d => h.Q + d.Q == x.Q && h.R + d.R == x.R)))
throw new ContentException(SettlementTargetsFileName, at + ".q", FormattableString.Invariant($"hex q={x.Q} r={x.R} is not next to {x.Id}'s hex in {SettlementHexesFileName}"));
}
diff --git a/sim/Statecraft.Sim/MapOverrides.cs b/sim/Statecraft.Sim/MapOverrides.cs
index 10244c90e..c6e44a88d 100644
--- a/sim/Statecraft.Sim/MapOverrides.cs
+++ b/sim/Statecraft.Sim/MapOverrides.cs
@@ -509,7 +509,7 @@ namespace Statecraft.Sim
var at = $"targets[{t.Id}]";
if (!Land(t.Q, t.R)) Broken(at, FormattableString.Invariant($"target hex q={t.Q} r={t.R} is not a land hex of the map"));
if (!settlement.TryGetValue(t.Id, out var s)) { Broken(at, $"settlement '{t.Id}' has no hex"); continue; }
- var bound = ContentLoader.TargetOnANeighbour.Contains(t.Id)
+ var bound = ContentLoader.TargetOnANeighbour.ContainsKey(t.Id)
? Movement.Neighbours.Any(d => s.Q + d.Q == t.Q && s.R + d.R == t.R)
: s.Q == t.Q && s.R == t.R;
if (!bound)