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.

sim: corridor segments read their cost and turns from Projects.Terms (follow-up to #1320, refs #792) (#1335)

Beriece85d7105a7
diff --git a/changelog.d/sim-corridor-terms-one-source-792.md b/changelog.d/sim-corridor-terms-one-source-792.md
new file mode 100644
index 000000000..cd0dd3d0b
--- /dev/null
+++ b/changelog.d/sim-corridor-terms-one-source-792.md
@@ -0,0 +1,2 @@
+- A corridor segment's cost and turns are read from one place in the sim (`Projects.Terms`), the one the info panel
+ already uses, so the two cannot drift apart (#792). No player-visible change; no golden moves.
diff --git a/sim/Statecraft.Sim/Corridors.cs b/sim/Statecraft.Sim/Corridors.cs
index d8ab194dc..a8646dd56 100644
--- a/sim/Statecraft.Sim/Corridors.cs
+++ b/sim/Statecraft.Sim/Corridors.cs
@@ -54,7 +54,7 @@ namespace Statecraft.Sim
if (work?.Segments[index] is SegmentWork seg)
return seg.BuiltOn == null ? $"{name} is already being built" : $"{name} is already built";
var r = c.RulesAt(s.Date).Mvp!; // the loader requires it in the GDD loop
- var cost = def.Kind == Rail ? r.RailSegmentCost : r.RoadSegmentCost;
+ var (cost, _) = Projects.Terms(r, action);
EconomySystem.PayOrBorrow(c, s, cost, "to build a corridor segment", why);
// As for sites (R-SITE-001): the turn of the order is the first build turn. The segment starts at 0, step 5 of this
// turn's resolve gives it its first turn of progress, and with 6 turns an order on turn T is built at the end of T+5.
@@ -90,7 +90,7 @@ namespace Statecraft.Sim
foreach (var w in s.Corridors.Values.ToList())
{
var def = c.Corridors.First(x => x.Id == w.Id);
- var turns = def.Kind == Rail ? r.RailSegmentTurns : r.RoadSegmentTurns;
+ var (_, turns) = Projects.Terms(r, def.Kind == Rail ? BuildRail : BuildRoad);
var cur = w;
for (int i = 0; i < cur.Segments.Count; i++)
{