A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
GDD 0.3 workshop staffing panel (Refs #1722, Refs #1701) (#2289)
Eyal Golan7130394c8321
diff --git a/changelog.d/1722-workshop-panel.md b/changelog.d/1722-workshop-panel.mdnew file mode 100644index 000000000..514e70992--- /dev/null+++ b/changelog.d/1722-workshop-panel.md@@ -0,0 +1,9 @@+### Added++- GDD 0.3 arms workshop staffing on the hex panel (Refs #1722, Refs #1701): under the gdd-0.3 ruleset only, a built arms+ workshop's hex shows how many of its city's workshops are staffed, with a stepper that orders more or fewer, this+ workshop's state and cycle (staffed months and the Money paid, or the next cycle's price), and why it waits (not+ staffed, the enemy holds the city, or last turn's pause). Where the city has nobody free, the panel shows the sim's+ refusal in English or Hebrew, and the end-of-turn notice words a refused staffing order the same way. A city's jobs+ order and its workshop order no longer replace each other in the order queue, and the jobs stepper and the Train+ buttons count a pending workshop order. The Hebrew lines are agent drafts awaiting a native read.diff --git a/docs/rules/mvp.md b/docs/rules/mvp.mdindex 893496d66..32c8f2854 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -430,7 +430,7 @@ R-ARMS-003: Recruit training (R-TRAIN-001) takes `arms_per_recruit_group` (1) ArR-ARMS-004: Under gdd-0.3 only, the arms workshop (`projects.yaml` `arms_workshop`, #1701) is a city project kind: `StartProject` builds it as R-PROJ-001 to R-PROJ-003 build any kind, for IL 15m and 3 turns (owner, 2 November 2026, #1701 OQ2: "IL 15m, 3 turns (Recommended)"; the gdd-0.3 catalogue's `arms_workshop` cost 15 and work 3). Built, it gives one workshop worker slot (`worker_slots: 1`, the catalogue's `arms_workshop.parts.worker_slots`) and adds no housing, condition or job slots: a workshop gives no Industry job (`docs/gdd/cities.md`, "Arms workshops"). Its row carries `rulesets: [gdd-0.3]`, and the loader leaves it out of every other ruleset's kinds, so a gdd-0.1 game neither lists nor starts it (`StartProject` refuses it as an unknown kind) and its state does not change; the row still moves the content hash. The loader refuses an unknown ruleset id in `rulesets`, `worker_slots` other than 0 or 1, a kind with a worker slot that has capacity, condition or job slots or is not limited to exactly gdd-0.3, and, under gdd-0.3, an `arms_workshop` whose worker slots differ from the catalogue's. It pays no upkeep: R-MONEY-002 has no rate for it (the catalogue's 0.50 is a Default). Its Hebrew name סדנת נשק is a draft awaiting a native speaker's review (`name_he_review: agent-checked`, #564; owner, 2 November 2026, #1701 OQ8).-R-ARMS-005: Under gdd-0.3, `AssignWorkers(city, "workshop", n)` is a standing order that staffs the city's first `n` built arms workshops, in ascending project id, and leaves the rest unstaffed (27M-13, owner-approved 1 November 2026: "Any free civilian. The cost tier follows the worker (novice or ordinary / apprentice / expert)."). A newly staffed workshop takes one of the city's civilians and craftsmen who hold no job; the worker stays one of them, with no job, profession or qualification change, is not employed (R-CITY-001) and earns no job income (R-CITY-002). On the aggregate cities every worker is priced at the ordinary or novice tier until the population ledger's tiers are live (owner, 2 November 2026, #1701 OQ6: "Accept all four (Recommended)"; R-POP-004). It is refused, state unchanged, for an unknown city, a negative count, more than the city's built workshops ("Town A has 1 arms workshop"), or more newly staffed workshops than the city's people without a job ("... civilians and craftsmen without a job"); under every other ruleset the `workshop` role is refused as "There is no such role". While the city's job default is on (R-CITY-009), a newly staffed workshop may take its worker from the default's jobs instead: the order is refused only past the city's civilians and craftsmen less its staffed workshops ("... civilians and craftsmen"), the city's employed falls to at most its civilians and craftsmen less the staffed workshops (a `city` cause, "Town: N groups in work"), and the default stays on, filling one job fewer (R-CITY-001; #2270 review fix, 2 November 2026). A number of jobs the player set (default off) is never lowered: there the order needs people without a job. A staffed workshop's worker is not idle: `Train` (R-TRAIN-001) and `ReassignPioneers` (R-QUAL-005) cannot take them, and the Train panel's limit (`Training.Available`) counts a pending `workshop` order's newly staffed workers, never as jobs. An unstaffed workshop keeps its record, paid cost and progress (a pause, R-ARMS-007). There is no limit on workshops per city beyond one project a hex and the starts a turn (R-PROJ-001; #1701 OQ7). `GameState.Workshops` holds every workshop ever staffed, by project id, and is hashed as `wshop[...]` only when it has one (R-LOOP-002). The order is not on the Unity hex panel yet (#1701 slice E).+R-ARMS-005: Under gdd-0.3, `AssignWorkers(city, "workshop", n)` is a standing order that staffs the city's first `n` built arms workshops, in ascending project id, and leaves the rest unstaffed (27M-13, owner-approved 1 November 2026: "Any free civilian. The cost tier follows the worker (novice or ordinary / apprentice / expert)."). A newly staffed workshop takes one of the city's civilians and craftsmen who hold no job; the worker stays one of them, with no job, profession or qualification change, is not employed (R-CITY-001) and earns no job income (R-CITY-002). On the aggregate cities every worker is priced at the ordinary or novice tier until the population ledger's tiers are live (owner, 2 November 2026, #1701 OQ6: "Accept all four (Recommended)"; R-POP-004). It is refused, state unchanged, for an unknown city, a negative count, more than the city's built workshops ("Town A has 1 arms workshop"), or more newly staffed workshops than the city's people without a job ("... civilians and craftsmen without a job"); under every other ruleset the `workshop` role is refused as "There is no such role". While the city's job default is on (R-CITY-009), a newly staffed workshop may take its worker from the default's jobs instead: the order is refused only past the city's civilians and craftsmen less its staffed workshops ("... civilians and craftsmen"), the city's employed falls to at most its civilians and craftsmen less the staffed workshops (a `city` cause, "Town: N groups in work"), and the default stays on, filling one job fewer (R-CITY-001; #2270 review fix, 2 November 2026). A number of jobs the player set (default off) is never lowered: there the order needs people without a job. A staffed workshop's worker is not idle: `Train` (R-TRAIN-001) and `ReassignPioneers` (R-QUAL-005) cannot take them, and the Train panel's limit (`Training.Available`) counts a pending `workshop` order's newly staffed workers, never as jobs. An unstaffed workshop keeps its record, paid cost and progress (a pause, R-ARMS-007). There is no limit on workshops per city beyond one project a hex and the starts a turn (R-PROJ-001; #1701 OQ7). `GameState.Workshops` holds every workshop ever staffed, by project id, and is hashed as `wshop[...]` only when it has one (R-LOOP-002). The hex panel of a built workshop (#1722, #1701 slice E) queues it: `Workshops.Check(city, n, pending)` gives the order's own refusal and, with this turn's queue, also counts the city's pending `job` order and its Train and reassignment orders, so a count it accepts is accepted whichever runs first; the jobs stepper's limit (`Cities.MaxWorkers` with the queue) counts a pending `workshop` order's newly staffed workers, as `Training.Available` does.R-ARMS-006: On step 6 of the turn, after the cities' job income, in ascending project id, each staffed arms workshop under gdd-0.3 works this month when its city is not held (R-CITY-010) and one of the city's people without a job is left for it (each workshop of the city takes one, in ascending project id; when none is left for it, it waits, and the Why screen says so). A workshop with no cycle under way first pays for one there (27M-11: "At the monthly production step."), at its worker's tier from the gdd-0.3 catalogue: `workshop.cost` IL 5m / 4m / 3m (ordinary or novice / apprentice / expert; `docs/GDD.md`'s balance ruling: "`workshop.cost` is Money per Arms and stays."), beside the IL 1m an Arms of R-ARMS-002 (owner, 2 November 2026, #1701 OQ1: "Keep as ruled"). A short Treasury borrows the rest (R-MONEY-003; 27M-12: "Automatic each month while the workshop is staffed, paid like any GDD cost."), but a cycle whose borrowing would take the debt past `debt_ceiling` is not paid: the workshop waits that month, the turn report says why (below), and nothing is borrowed (owner, 2 November 2026, #1701 OQ4: "Refuse past the ceiling (Recommended)"; exactly at the ceiling is allowed, and a Treasury that pays in full is never refused, as in R-ARMS-002). The month a cycle is paid is its first staffed month (#1701 OQ3: "Accept all four (Recommended)"). After `workshop.staffed_turns` (3) staffed months the cycle adds 1 Arms to the stock (R-ARMS-001) and ends, and the next month starts the next one by itself, with no order. A worker change keeps the cycle's paid cost and progress; only the next cycle is priced at the new worker's tier (27M-13). An unstaffed workshop, or one in a held city, keeps its cycle as it is and is not charged. The turn-report panel lists, in a row of its own after the stocks, each Arms a workshop made ("Workshop in Town: +1 Arms") and each ceiling pause ("Workshop in Town paused: debt ceiling") (owner, 2 November 2026, #1701 A1: "Yes, in the panel (Recommended)", the option "The turn-report panel shows 'Workshop in <city>: +1 Arms' and 'Workshop in <city> paused: debt ceiling'."); a no-worker pause is on the Why screen only. A city's Arms are one line and its ceiling pauses another, each with its count when there are two or more ("Workshops in Town (2): +2 Arms", "Workshops in Town (2) paused: debt ceiling"), in the order each first appears among the turn's causes (owner, 2 November 2026: "Combine per city (Recommended)", the option "'Workshops in Tel Aviv (6): +6 Arms'; pauses likewise combined with a count."). The option gives no wording for one workshop, so a city with one keeps A1's line. The count is the number of the sim's causes; the UI computes nothing else.diff --git a/sim/Statecraft.Sim.Tests/ArmsWorkshopTests.cs b/sim/Statecraft.Sim.Tests/ArmsWorkshopTests.csindex dfbc7f222..81eaad66d 100644--- a/sim/Statecraft.Sim.Tests/ArmsWorkshopTests.cs+++ b/sim/Statecraft.Sim.Tests/ArmsWorkshopTests.cs@@ -204,6 +204,75 @@ public class ArmsWorkshopTestsAssert.Equal(new[] { "0" }, off.Why.Single(x => x.Key == CauseKeys.WorkshopWorkers).Args);}+ // R-ARMS-005 (#1722 slice E): Workshops.Check, which the hex panel asks before it offers a staffing order, gives exactly+ // the refusal the order gets at End turn, and changes nothing.+ [Theory]+ [MemberData(nameof(StaffRefusals))]+ public void CheckGivesTheOrdersOwnRefusalAndChangesNothing(string why, string reason)+ {+ var (c, s, id) = Built(civilians: why == "nobody at all" ? 0 : 10, employed: why == "nobody without a job" ? 10 : why == "nobody at all" ? 0 : 6, jobs: 10,+ jobsDefault: why != "nobody without a job");+ if (why == "gdd-0.1") { c = Load(false); s = Simulation.NewGame(c, 1, Mode.Historical); }+ if (why == "still building") s.CityProjects[id] = new CityProject(id, Workshops.ArmsWorkshop, "town_a", 1, 1, 2);+ var order = why switch { "unknown city" => Staff(1, "atlantis"), "negative" => Staff(-1), "more than built" => Staff(2), _ => Staff(1) };+ var before = s.Hash();+ Assert.Equal(reason, Workshops.Check(c, s, order.City, order.Count, Array.Empty<Command>()));+ Assert.Equal(before, s.Hash());+ Assert.Equal(reason, Assert.Single(Step(c, s, order).Rejected).Reason);+ }++ // R-ARMS-005: an order Check accepts is accepted; unstaffing (a lower count) is always accepted.+ [Fact]+ public void CheckAcceptsWhatTheTurnAccepts()+ {+ var (c, s, _) = Built(jobsDefault: false);+ Assert.Null(Workshops.Check(c, s, "town_a", 1, Array.Empty<Command>()));+ var staffed = Step(c, s, Staff(1));+ Assert.Empty(staffed.Rejected);+ Assert.Null(Workshops.Check(c, staffed.State, "town_a", 0, Array.Empty<Command>()));+ Assert.Equal(1, Workshops.Built(c, s, "town_a"));+ }++ // R-ARMS-005 with R-CITY-001 (#1722 slice E): with this turn's queue, Check counts a pending "job" order's jobs (which turn+ // the job default off) and every Train or reassignment there, so an order it accepts is still accepted if the job order+ // runs first. Here the job order takes the last free person, and the turn refuses the staffing with Check's words.+ [Theory]+ [InlineData(true)]+ [InlineData(false)]+ public void CheckCountsThisTurnsJobOrder(bool jobsDefault)+ {+ var (c, s, _) = Built(civilians: 10, employed: jobsDefault ? 10 : 9, jobs: 10, jobsDefault: jobsDefault);+ Assert.Null(Workshops.Check(c, s, "town_a", 1, Array.Empty<Command>()));+ var job = new AssignWorkers("town_a", "job", 10);+ var reason = Workshops.Check(c, s, "town_a", 1, new Command[] { job, Staff(1) });+ Assert.Equal("Town A has 0 civilians and craftsmen without a job", reason);+ Assert.Equal(reason, Assert.Single(Step(c, s, job, Staff(1)).Rejected).Reason);+ }++ // R-ARMS-005 with R-CITY-001 (#1722 slice E): the jobs stepper's limit counts a pending staffing order's newly staffed+ // workers, as Training.Available does, so a jobs count it allows is still accepted if the staffing runs first.+ [Fact]+ public void MaxWorkersCountsAPendingStaffingOrder()+ {+ var (c, s, _) = Built(civilians: 10, employed: 6, jobs: 10, jobsDefault: false);+ Assert.Equal(10, Cities.MaxWorkers(s, "town_a", Array.Empty<Command>()));+ Assert.Equal(9, Cities.MaxWorkers(s, "town_a", new Command[] { Staff(1) }));+ Assert.Equal("Town A has 9 civilians and craftsmen", Assert.Single(Step(c, s, Staff(1), new AssignWorkers("town_a", "job", 10)).Rejected).Reason);+ Assert.Empty(Step(c, s, Staff(1), new AssignWorkers("town_a", "job", 9)).Rejected);+ }++ // R-ARMS-005 (#1722 slice E): the refusals' English are format constants, so the UI can word them in its language+ // (SimBridge.ReasonText), and the turn's reasons are those formats filled in.+ [Fact]+ public void TheRefusalsAreTheFormatConstants()+ {+ string F(string format, params object[] v) => string.Format(System.Globalization.CultureInfo.InvariantCulture, format, v);+ Assert.Equal("Town A has 1 arms workshop", F(Workshops.RefusedBuiltOne, "Town A"));+ Assert.Equal("Town A has 0 arms workshops", F(Workshops.RefusedBuilt, "Town A", 0));+ Assert.Equal("Town A has 0 civilians and craftsmen", F(Workshops.RefusedPeople, "Town A", 0));+ Assert.Equal("Town A has 0 civilians and craftsmen without a job", F(Workshops.RefusedPeopleNoJob, "Town A", 0));+ }+// R-ARMS-005, R-LOOP-002: the workshops are hashed as wshop[...] only when there is one, so a gdd-0.1 state hashes as before.[Fact]public void TheWorkshopsAreHashedOnlyWhenPresent()diff --git a/sim/Statecraft.Sim/Cities.cs b/sim/Statecraft.Sim/Cities.csindex 1c6aa17d6..601fd8b00 100644--- a/sim/Statecraft.Sim/Cities.cs+++ b/sim/Statecraft.Sim/Cities.cs@@ -22,11 +22,15 @@ namespace Statecraft.Sim/// <summary>R-CITY-001 with R-TRAIN-001: <see cref="MaxWorkers(City)"/> once the city's Train, Reinforce and Reassign/// orders in <paramref name="pending"/> (this turn's queue) have taken their civilians, so a count up to it keeps every one/// of them accepted, whatever order they run in. Every queued reassignment counts in full, craftsmen too (#1548): if the- /// job order runs first, the civilians a reassignment needs are already in work.</summary>+ /// job order runs first, the civilians a reassignment needs are already in work. R-ARMS-005: the staffed arms workshops+ /// count as a pending "workshop" order leaves them, when it staffs more (#1722 slice E, as Training.Available does).</summary>public static int MaxWorkers(GameState s, string city, IEnumerable<Command> pending){var x = s.Cities[city];- return Math.Max(0, Math.Min(x.JobSlots, x.Civilians + x.Craftsmen - Workshops.Staffed(s, city) - Training.Ordered(city, pending)));+ var list = pending as IReadOnlyCollection<Command> ?? pending.ToList();+ var staffed = Math.Max(Workshops.Staffed(s, city),+ list.OfType<AssignWorkers>().Where(w => w.City == city && w.Role == Workshops.Role).Select(w => w.Count).DefaultIfEmpty(0).Max());+ return Math.Max(0, Math.Min(x.JobSlots, x.Civilians + x.Craftsmen - staffed - Training.Ordered(city, list)));}/// <summary>R-CITY-007: a city's start people in units: the nearest unit (a half rounds up), and at least 1 for a citydiff --git a/sim/Statecraft.Sim/Workshops.cs b/sim/Statecraft.Sim/Workshops.csindex 48d7c66e1..8f1765536 100644--- a/sim/Statecraft.Sim/Workshops.cs+++ b/sim/Statecraft.Sim/Workshops.cs@@ -18,6 +18,41 @@ namespace Statecraft.Sim/// of its city without a job was left for it, or paying for its next cycle would take the debt past mvp.debt_ceiling.</summary>public const string NoWorker = "no_worker", DebtCeiling = "debt_ceiling";+ /// <summary>R-ARMS-005: a staffing order's refusals (Check), formats with the settlement's name ({0}) and a count ({1},+ /// invariant). The English is what a turn's Rejected list and a save carry; the UI words it in its language+ /// (SimBridge.ReasonText, #1722).</summary>+ public const string RefusedBuiltOne = "{0} has 1 arms workshop", RefusedBuilt = "{0} has {1} arms workshops",+ RefusedPeople = "{0} has {1} civilians and craftsmen", RefusedPeopleNoJob = "{0} has {1} civilians and craftsmen without a job";++ static string Refused(string format, params object[] values) => string.Format(System.Globalization.CultureInfo.InvariantCulture, format, values);++ /// <summary>R-ARMS-005: the number of the city's built arms workshops, the most AssignWorkers(city, "workshop", n) staffs.</summary>+ public static int Built(Content c, GameState s, string city) => BuiltIn(c, s, city).Count;++ /// <summary>R-ARMS-005: why AssignWorkers(<paramref name="city"/>, "workshop", <paramref name="count"/>) would be+ /// refused, or null; nothing changes. With an empty <paramref name="pending"/> it is the order's own check. With this+ /// turn's queue (#1722 slice E, the hex panel) it also counts the city's pending "job" order (whose jobs then hold+ /// no workshop worker, and which turns R-CITY-009's default off) and its Train and reassignment orders+ /// (Training.Ordered), so a count it accepts is still accepted whichever of them runs first.</summary>+ public static string? Check(Content c, GameState s, string city, int count, IEnumerable<Command> pending)+ {+ if (!s.Cities.TryGetValue(city, out var x)) return "There is no such city";+ if (c.Ruleset != SaveGame.Gdd03Ruleset) return "There is no such role";+ if (count < 0) return "The number of workers cannot be negative";+ var name = PlayerText.Settlement(c, city);+ var built = Built(c, s, city);+ if (count > built) return built == 1 ? Refused(RefusedBuiltOne, name) : Refused(RefusedBuilt, name, built);+ var list = pending as IReadOnlyCollection<Command> ?? pending.ToList();+ var job = list.OfType<AssignWorkers>().Where(w => w.City == city && w.Role == "job").Select(w => (int?)w.Count).Max();+ var byDefault = x.JobsDefault && job == null;+ var staffed = Staffed(s, city);+ // R-CITY-009: while the city's job default is on, a newly staffed workshop may take its worker from the default's+ // jobs (the default then fills one job fewer, R-CITY-001); a number the player set is not lowered.+ var free = x.Civilians + x.Craftsmen - Math.Max(x.JobsDefault ? 0 : x.Employed, job ?? 0) - staffed - Training.Ordered(city, list);+ if (count - staffed > free) return Refused(byDefault ? RefusedPeople : RefusedPeopleNoJob, name, Math.Max(0, free));+ return null;+ }+/// <summary>R-ARMS-005: the city's built workshops (a project whose kind has a worker slot, R-ARMS-004), in ascending id.</summary>static List<CityProject> BuiltIn(Content c, GameState s, string city) =>s.CityProjects.Values.Where(p => p.City == city && p.BuiltOn != null && c.ProjectKinds.First(k => k.Id == p.Kind).WorkerSlots > 0).ToList();@@ -36,18 +71,11 @@ namespace Statecraft.Siminternal static string? Staff(Content c, GameState s, string city, int count, List<Cause> why){PopulationLedger.RefuseAggregate(s);- if (count < 0) return "The number of workers cannot be negative";+ if (Check(c, s, city, count, Array.Empty<Command>()) is string refused) return refused;var name = PlayerText.Settlement(c, city);var built = BuiltIn(c, s, city);- if (count > built.Count)- return FormattableString.Invariant($"{name} has {built.Count} {(built.Count == 1 ? "arms workshop" : "arms workshops")}");var x = s.Cities[city];var staffed = Staffed(s, city);- // R-CITY-009: while the city's job default is on, a newly staffed workshop may take its worker from the default's- // jobs (the default then fills one job fewer, R-CITY-001); a number the player set is not lowered.- var free = x.Civilians + x.Craftsmen - (x.JobsDefault ? 0 : x.Employed) - staffed;- if (count - staffed > free)- return FormattableString.Invariant($"{name} has {Math.Max(0, free)} civilians and craftsmen{(x.JobsDefault ? "" : " without a job")}");var employed = Math.Min(x.Employed, x.Civilians + x.Craftsmen - count);if (employed != x.Employed){diff --git a/unity/Assets/Scripts/UI/GddHexPanel.cs b/unity/Assets/Scripts/UI/GddHexPanel.csindex ab4cfe556..f2f191daa 100644--- a/unity/Assets/Scripts/UI/GddHexPanel.cs+++ b/unity/Assets/Scripts/UI/GddHexPanel.cs@@ -18,9 +18,10 @@ namespace Statecraft.Game.UI/// <para>On any hex a city can build on (Projects.CitiesFor, #1122): the city that builds (the player picks when several/// can), and Build for each content project kind with its cost and turns (Projects.CityTurnsToBuild), disabled with the sim's own refusal/// (Projects.CheckCityReason) worded in the UI's language; or the project there, with its turns left and Cancel, or the- /// day it was finished (R-PROJ-001 to R-PROJ-003).</para>+ /// day it was finished (R-PROJ-001 to R-PROJ-003); under gdd-0.3, on a built arms workshop, its staffing and cycle (#1722,+ /// R-ARMS-005 to R-ARMS-007).</para>/// <para>Every number is the sim's, and every order goes through the bridge's queue: the sim rules on it when the turn- /// runs. No rule lives here: the limits are the sim's public helpers (Cities.MaxWorkers, Training.Available), asked with+ /// runs. No rule lives here: the limits are the sim's public helpers (Cities.MaxWorkers, Training.Available, Workshops.Check), asked with/// the queue, and a button is disabled only where the sim would refuse that order, or another one in the queue, anyway.</para></summary>public static class GddHexPanel{@@ -326,6 +327,7 @@ namespace Statecraft.Game.UIif (project.BuiltOn is DateTime built){Line(host, "city-project-state", text.Format("city.project_built", Kind(project.Kind), townName(project.City), Date(text, built)));+ WorkshopPart(host, bridge, text, project, townName);return;}Line(host, "city-project-state", text.Format("city.project_building", Kind(project.Kind), townName(project.City), Turns(text, Projects.CityTurnsToBuild(c, s, project.Kind, project.TurnsLeft, project.Progress))));@@ -386,6 +388,52 @@ namespace Statecraft.Game.UI}}+ /// <summary>#1722 slice E (#1701; R-ARMS-005 to R-ARMS-007), gdd-0.3 only: on a built arms workshop (a kind with a worker+ /// slot, R-ARMS-004), its city's staffing stepper and this workshop's state. AssignWorkers(city, "workshop", n) staffs the+ /// city's first n built workshops in ascending id, so the stepper is the city's count (Workshops.Staffed, or the queued+ /// order's) of Workshops.Built; stepping back to the current count withdraws the order. + is off where Workshops.Check,+ /// asked with this turn's queue, refuses one more, and while a workshop is left unstaffed that refusal shows in the UI's+ /// language (SimBridge.ReasonText). This workshop: staffed or not (its Workshop record), its cycle under way (staffed+ /// months of workshop.staffed_turns and the Money paid) or the next cycle's price at its worker's tier, the pause while+ /// the enemy holds its city (Cities.Held, R-CITY-010), and the last turn's pauses for its city as the Why screen words+ /// them (CauseKeys.WorkshopPaused). Nothing is computed here.</summary>+ static void WorkshopPart(VisualElement host, SimBridge bridge, UiText text, CityProject project, Func<string, string> townName)+ {+ var c = bridge.Content; var s = bridge.State;+ if (c.Ruleset != SaveGame.Gdd03Ruleset || c.ProjectKinds.First(k => k.Id == project.Kind).WorkerSlots == 0) return;+ var city = project.City;+ var built = Workshops.Built(c, s, city);+ var staffed = Workshops.Staffed(s, city);+ var queued = bridge.QueuedLike(new AssignWorkers(city, Workshops.Role, 0)) as AssignWorkers;+ var target = queued?.Count ?? staffed;+ var refusal = Workshops.Check(c, s, city, target + 1, bridge.Queued);+ var row = Row(host, "city-workshops-row");+ Button(row, "city-workshops-less", "−", () => Staff(bridge, city, staffed, target - 1)).SetEnabled(target > 0);+ Line(row, "city-workshops", text.Format(queued == null ? "city.workshops_staffed" : "city.workshops_ordered", target, built));+ Button(row, "city-workshops-more", "+", () => Staff(bridge, city, staffed, target + 1)).SetEnabled(refusal == null);+ if (refusal != null && target < built) Line(host, "city-workshops-reason", SimBridge.ReasonText(text, refusal, c, bridge.TownNamesHe));++ s.Workshops.TryGetValue(project.Id, out var w);+ Line(host, "city-workshop-state", text[w?.Staffed == true ? "city.workshop_staffed" : "city.workshop_unstaffed"]);+ if (w != null)+ {+ var rules = SyntheticWorkshopRules.FromCatalogue(c.Gdd03Balance!); // the loader requires it under gdd-0.3+ Line(host, "city-workshop-cycle", w.PaidCost is decimal paid+ ? text.Format("city.workshop_cycle", w.Progress, rules.StaffedTurns, PlayerText.Money(c, "treasury", (double)paid))+ : text.Format("city.workshop_next", PlayerText.Money(c, "treasury", (double)rules.Price(w.WorkerTier))));+ }+ if (Cities.Held(c, s).Contains(city)) Line(host, "city-workshop-held", text.Format("city.workshop_held", townName(city)));+ var paused = (bridge.Session.Last?.Why ?? Array.Empty<Cause>()).Where(x => x.Key == CauseKeys.WorkshopPaused && x.Target == city)+ .Select(x => CauseText.Line(x, c, Array.Empty<Statecraft.Game.Map.Units.UnitEntry>(), text, bridge.TownNamesHe)).Distinct().ToList();+ for (int i = 0; i < paused.Count; i++) Line(host, "city-workshop-paused-" + i.ToString(CultureInfo.InvariantCulture), paused[i]);+ }++ static void Staff(SimBridge bridge, string city, int current, int count)+ {+ if (count != current) { bridge.Queue(new AssignWorkers(city, Workshops.Role, count)); return; }+ if (bridge.QueuedLike(new AssignWorkers(city, Workshops.Role, 0)) is Command order) bridge.Withdraw(order);+ }+/// <summary>A city-project refusal (Projects.CheckCityReason) in the UI's language: the map actions' strings where the/// sim's English is theirs, else city.project_reason.*. The sim's English for the kinds this panel cannot meet: an/// unknown kind or city, a distance (CitiesFor lists only the cities in reach) or another project on the hex (itsdiff --git a/unity/Assets/Scripts/UI/SimBridge.cs b/unity/Assets/Scripts/UI/SimBridge.csindex 9c6968870..207288d1c 100644--- a/unity/Assets/Scripts/UI/SimBridge.cs+++ b/unity/Assets/Scripts/UI/SimBridge.cs@@ -10,8 +10,8 @@ namespace Statecraft.Game.UI/// <summary>The UI's only door into the simulation (spec section 6). Holds the GameSession, collects this turn's/// orders, runs End Turn and tells the screens to refresh. R-TURN-004's instant orders are committed and shown at once;/// deferred orders take effect at End Turn, in the order given. Each deferred order replaces an earlier one with the same key (one choice per event, one call-up level, one budget, one appointee- /// per office, one policy level per policy, one build per hex, one work order per city, one training order per city and- /// track, one cancel per cohort, one pioneer order per unit).</summary>+ /// per office, one policy level per policy, one build per hex, one work order per city and role (jobs, and under gdd-0.3 the arms+ /// workshops, #1722), one training order per city and track, one cancel per cohort, one pioneer order per unit).</summary>public sealed class SimBridge{readonly List<Command> deferred = new List<Command>();@@ -77,7 +77,7 @@ namespace Statecraft.Game.UISetPolicy p => "policy:" + p.Policy,Appoint a => "appoint:" + a.Office,MapAction m => FormattableString.Invariant($"map:{m.Q},{m.R}"),- AssignWorkers w => "work:" + w.City,+ AssignWorkers w => "work:" + w.City + ":" + w.Role, // #1722: a city's jobs and workshop orders keep their own slotsTrain t => "train:" + t.City + ":" + t.Track,CancelTraining x => FormattableString.Invariant($"untrain:{x.Cohort}"),ReturnCraftsmen r => "retcraft:" + r.City,@@ -262,6 +262,11 @@ namespace Statecraft.Game.UI(Training.RefusedNoHakhshara, "unit.reinforce_refused.no_hakhshara"),(Training.RefusedIdle, "unit.reinforce_refused.idle"),(Training.RefusedArms, "unit.reinforce_refused.arms"),+ // R-ARMS-005 (#1722): a workshop staffing order's refusals, the panel's and the end of turn's.+ (Workshops.RefusedBuiltOne, "workshop.refused_built_one"),+ (Workshops.RefusedBuilt, "workshop.refused_built"),+ (Workshops.RefusedPeople, "workshop.refused_people"),+ (Workshops.RefusedPeopleNoJob, "workshop.refused_people_no_job"),}.Select(x => (new Regex("^" + string.Join("(.+?)", Regex.Split(x.format, @"\{\d+\}").Select(Regex.Escape)) + "$"), x.key)).ToArray();/// <summary>A sim refusal in the UI's language where it has a string (<see cref="ReasonKeys"/>, <see cref="ReasonFormats"/>),diff --git a/unity/Assets/Tests/EditMode/CityProjectPanelTests.cs b/unity/Assets/Tests/EditMode/CityProjectPanelTests.csindex 520333668..bd332c4c5 100644--- a/unity/Assets/Tests/EditMode/CityProjectPanelTests.cs+++ b/unity/Assets/Tests/EditMode/CityProjectPanelTests.cs@@ -298,3 +298,247 @@ public class CityProjectPanelTestsStringAssert.Contains("\u05d9\u05e7\u05d1", line); // יקב}}++/// <summary>#1722 slice E (#1701; R-ARMS-005 to R-ARMS-007): a built arms workshop's staffing control in the info panel,+/// gdd-0.3 only, on a real SimBridge with the real content run under gdd-0.3 (its projects.yaml has the arms_workshop row).+/// The stepper is the city's AssignWorkers(city, "workshop", n); every number, limit and refusal is the sim's+/// (Workshops.Built, Workshops.Staffed, Workshops.Check, the Workshop record, Cities.Held, the last turn's causes).</summary>+public class WorkshopPanelTests+{+ static readonly Content C01 = ContentLoader.Load(Paths.Content);+ static readonly Content C03 = Load03();+ static readonly Dictionary<string, string> Towns =+ SettlementPlacer.Parse(File.ReadAllText(Path.Combine(Paths.Content, "map", SettlementPlacer.DefaultFileName))).ToDictionary(t => t.Id, t => t.Name);+ static readonly Dictionary<string, string> TownsHe =+ SettlementPlacer.Parse(File.ReadAllText(Path.Combine(Paths.Content, "map", SettlementPlacer.DefaultFileName))).ToDictionary(t => t.Id, t => t.NameHe);+ static UiText En => UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.Strings).text);+ static UiText He => UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml");+ const string City = "haifa";++ /// <summary>The real content under gdd-0.3, as NoAttentionPresentationTests loads it.</summary>+ static Content Load03()+ {+ var dir = Paths.Content;+ return ContentLoader.Load(rel =>+ {+ var path = Path.Combine(dir, rel);+ if (!File.Exists(path)) return null;+ var value = File.ReadAllText(path);+ return rel == "eras.yaml" ? value.Replace("loop: gdd", "loop: gdd, ruleset: gdd-0.3") : value;+ }, Directory.GetFiles(Path.Combine(dir, "events"), "*.yaml").Select(f => "events/" + Path.GetFileName(f)));+ }++ /// <summary>A hex only Haifa reaches (CityProjectPanelTests' Lone), by the sim's own helper.</summary>+ static (int q, int r) Hex(Content c)+ {+ var s = GameSession.New(c, GoldenRun.Seed, Mode.Historical).State;+ var hex = c.Hexes.Where(h => h.Land && Projects.CitiesFor(c, s, h.Q, h.R).SequenceEqual(new[] { City })).OrderBy(h => h.Q).ThenBy(h => h.R).First();+ return (hex.Q, hex.R);+ }++ /// <summary>A game of <paramref name="c"/> with a project of <paramref name="kind"/> for Haifa on its hex (built unless+ /// <paramref name="turnsLeft"/> is above 0), and Haifa with 10 civilians, <paramref name="employed"/> of them in the jobs+ /// the player set (the job default off). The project's id is the second value.</summary>+ static (SimBridge Bridge, int Id) Game(Content c, UiText text, string kind = Workshops.ArmsWorkshop, int employed = 6, int turnsLeft = 0,+ Action<GameState, int>? edit = null, Func<GameSession, StepResult?>? last = null)+ {+ var (q, r) = Hex(c);+ var g = GameSession.New(c, GoldenRun.Seed, Mode.Historical);+ var s = g.State;+ var x = s.Cities[City];+ s.Cities[City] = new City(x.Id, x.HousingCapacity, 10, 10, employed, 0, 0, x.Condition, jobsDefault: false);+ var id = s.NextId++;+ var p = new CityProject(id, kind, City, q, r, turnsLeft);+ s.CityProjects.Add(id, turnsLeft == 0 ? p.Built(s.Date) : p);+ edit?.Invoke(s, id);+ if (last?.Invoke(g) is StepResult result) typeof(GameSession).GetProperty(nameof(GameSession.Last))!.SetValue(g, result);+ return (new SimBridge(g, text) { TownNamesHe = TownsHe }, id);+ }++ static InfoPanelPresenter Panel(UiTestKit ui, SimBridge bridge, UiText text) => new InfoPanelPresenter(ui.Root, bridge, text, Towns, townNamesHe: TownsHe);++ static AssignWorkers? Queued(SimBridge b) => b.QueuedLike(new AssignWorkers(City, Workshops.Role, 0)) as AssignWorkers;++ // R-ARMS-005: the control shows on a built arms workshop under gdd-0.3, and nowhere else: not on a workshop being+ // built, not on another built kind, and never under gdd-0.1 (whose content has no workshop kind).+ [Test]+ public void TheControlShowsOnABuiltArmsWorkshopUnderGdd03Only([Values] bool hebrew)+ {+ var t = hebrew ? He : En;+ Assert.AreEqual(SaveGame.Gdd03Ruleset, C03.Ruleset, "precondition: the content runs under gdd-0.3");+ Assert.IsTrue(C03.ProjectKinds.Any(k => k.Id == Workshops.ArmsWorkshop), "precondition: gdd-0.3 has the workshop kind");+ Assert.IsFalse(C01.ProjectKinds.Any(k => k.Id == Workshops.ArmsWorkshop), "precondition: gdd-0.1 has none");+ foreach (var (c, kind, turns, shown) in new[]+ {+ (C03, Workshops.ArmsWorkshop, 0, true),+ (C03, Workshops.ArmsWorkshop, 2, false),+ (C03, "industry", 0, false),+ (C01, "industry", 0, false),+ })+ {+ using var ui = new UiTestKit();+ var (bridge, _) = Game(c, t, kind, turnsLeft: turns);+ using var panel = Panel(ui, bridge, t);+ var (q, r) = Hex(c);+ panel.Show(q, r);+ Assert.IsNotNull(ui.Root.Q("city-project-state"), $"{c.Ruleset} {kind} {turns}: precondition, the project's part shows");+ Assert.AreEqual(shown, ui.Root.Q("city-workshops-row") != null, $"{c.Ruleset} {kind} {turns}");+ Assert.AreEqual(shown, ui.Root.Q("city-workshop-state") != null, $"{c.Ruleset} {kind} {turns}");+ if (!shown) continue;+ Assert.AreEqual(t.Format("city.workshops_staffed", 0, 1), ui.Q<Label>("city-workshops").text, "the sim's counts: none staffed of 1 built");+ Assert.AreEqual(t["city.workshop_unstaffed"], ui.Q<Label>("city-workshop-state").text);+ Assert.IsFalse(ui.Q<Button>("city-workshops-less").enabledSelf, "none staffed: nothing to unstaff");+ Assert.IsTrue(ui.Q<Button>("city-workshops-more").enabledSelf, "4 people without a job: one may staff it");+ Assert.IsNull(ui.Root.Q("city-workshops-reason"));+ }+ }++ // R-ARMS-005: + queues AssignWorkers(city, "workshop", n + 1) for the workshop's city, the line reads the ordered count,+ // and - back to the current count withdraws the order (as the jobs stepper does). The sim accepts the queued order.+ [Test]+ public void TheStepperQueuesTheWorkshopRoleAndStepsBackToNoOrder()+ {+ using var ui = new UiTestKit();+ var (bridge, id) = Game(C03, En);+ using var panel = Panel(ui, bridge, En);+ var (q, r) = Hex(C03);+ panel.Show(q, r);+ ui.Press("city-workshops-more");+ var order = Queued(bridge);+ Assert.IsNotNull(order, "the stepper queues an AssignWorkers order");+ Assert.AreEqual((City, Workshops.Role, 1), (order!.City, order.Role, order.Count));+ Assert.AreEqual(En.Format("city.workshops_ordered", 1, 1), ui.Q<Label>("city-workshops").text);+ Assert.IsFalse(ui.Q<Button>("city-workshops-more").enabledSelf, "its one workshop is ordered staffed");+ Assert.IsNull(ui.Root.Q("city-workshops-reason"), "every workshop is staffed: no refusal to explain");+ ui.Press("city-workshops-less");+ Assert.IsNull(Queued(bridge), "back at the current count: no order is left queued");+ Assert.AreEqual(En.Format("city.workshops_staffed", 0, 1), ui.Q<Label>("city-workshops").text);+ ui.Press("city-workshops-more");+ Assert.IsTrue(bridge.EndTurn().State.Workshops[id].Staffed, "the sim accepts the order the panel queued");+ }++ // #1722 (2 Nov note, 1): a jobs order and a workshop order for the same city keep their own slots in the queue, so+ // neither replaces the other; and (2) Training.Available, the Train buttons' limit, counts the pending staffing.+ [Test]+ public void AJobsOrderAndAStaffingOrderForOneCityAreBothQueuedAndTrainingCountsIt()+ {+ using var ui = new UiTestKit();+ var (bridge, _) = Game(C03, En);+ using var panel = Panel(ui, bridge, En);+ var (q, r) = Hex(C03);+ Assert.IsNull(bridge.Queue(new AssignWorkers(City, "job", 7)));+ var before = Training.Available(bridge.State, City, bridge.Queued);+ panel.Show(q, r);+ ui.Press("city-workshops-more");+ Assert.AreEqual(2, bridge.Queued.OfType<AssignWorkers>().Count(w => w.City == City), "the staffing order did not replace the jobs order");+ Assert.AreEqual(7, ((AssignWorkers)bridge.QueuedLike(new AssignWorkers(City, "job", 0))!).Count);+ Assert.AreEqual(1, Queued(bridge)!.Count);+ Assert.AreEqual(before - 1, Training.Available(bridge.State, City, bridge.Queued), "the pending workshop worker is not offered for training");+ }++ // R-ARMS-005: with nobody left for it, + is off and the panel shows the sim's own refusal (Workshops.Check with this+ // turn's queue), in the UI's language: SimBridge.ReasonText, as the end-of-turn toast words it.+ [Test]+ public void WithNobodyFreeTheSimsRefusalShowsInBothLanguages([Values] bool hebrew)+ {+ var t = hebrew ? He : En;+ using var ui = new UiTestKit();+ var (bridge, _) = Game(C03, t, employed: 10);+ using var panel = Panel(ui, bridge, t);+ var (q, r) = Hex(C03);+ panel.Show(q, r);+ var reason = Workshops.Check(C03, bridge.State, City, 1, bridge.Queued);+ Assert.AreEqual(string.Format(System.Globalization.CultureInfo.InvariantCulture, Workshops.RefusedPeopleNoJob, PlayerText.Settlement(C03, City), 0), reason,+ "precondition: the sim refuses one more");+ Assert.IsFalse(ui.Q<Button>("city-workshops-more").enabledSelf);+ var line = ui.Q<Label>("city-workshops-reason").text;+ Assert.AreEqual(SimBridge.ReasonText(t, reason!, C03, TownsHe), line);+ if (hebrew)+ {+ Assert.AreNotEqual(reason, line, "the Hebrew string, not the sim's English");+ StringAssert.Contains(TownsHe[City], line);+ // A no-break space joins "יש" to the count (between its left-to-right marks), so the panel never wraps "(יש" and+ // "0)" onto two lines.+ // Ordinal on purpose: StringAssert compares by culture, which ignores U+200E (2359a680e) and may not tell U+00A0+ // from a plain space.+ Assert.IsTrue(line.EndsWith("(יש\u00A0\u200E0\u200E)", StringComparison.Ordinal), line);+ }+ else Assert.AreEqual("Haifa has 0 civilians and craftsmen without a job", line);+ }++ // Both people refusals keep "יש" and the count on one line: a no-break space (U+00A0) between them, no plain space.+ [Test]+ public void TheHebrewPeopleRefusalsJoinTheCountWithANoBreakSpace()+ {+ foreach (var key in new[] { "workshop.refused_people", "workshop.refused_people_no_job" })+ {+ // Ordinal, as above: a culture compare may not tell U+00A0 from a plain space.+ Assert.IsTrue(He[key].EndsWith("(יש\u00A0{1})", StringComparison.Ordinal), key + ": " + He[key]);+ Assert.AreEqual(-1, He[key].IndexOf("יש {1}", StringComparison.Ordinal), key + ": " + He[key]);+ }+ }++ // R-ARMS-005: each staffing refusal has a string in both languages, and the English is the sim's own words.+ [Test]+ public void EveryStaffingRefusalHasAStringInBothLanguages()+ {+ foreach (var reason in new[]+ {+ string.Format(System.Globalization.CultureInfo.InvariantCulture, Workshops.RefusedBuiltOne, "Haifa"),+ string.Format(System.Globalization.CultureInfo.InvariantCulture, Workshops.RefusedBuilt, "Haifa", 2),+ string.Format(System.Globalization.CultureInfo.InvariantCulture, Workshops.RefusedPeople, "Haifa", 0),+ string.Format(System.Globalization.CultureInfo.InvariantCulture, Workshops.RefusedPeopleNoJob, "Haifa", 0),+ })+ {+ Assert.AreEqual(reason, SimBridge.ReasonText(En, reason, C03, TownsHe), "the English string is the sim's own");+ var he = SimBridge.ReasonText(He, reason, C03, TownsHe);+ Assert.AreNotEqual(reason, he, "no Hebrew string for: " + reason);+ StringAssert.IsMatch("[א-ת]", he, reason);+ StringAssert.Contains(TownsHe[City], he, "the town in Hebrew");+ }+ }++ // R-ARMS-006, R-ARMS-007, R-CITY-010: a staffed workshop's cycle under way (staffed months of workshop.staffed_turns and+ // the Money paid), the pause while the enemy holds its city, and the last turn's pauses for its city as the Why screen+ // words them; with no cycle, the next cycle's price at its worker's tier.+ [Test]+ public void AStaffedWorkshopShowsItsCycleAndWhyItWaits([Values] bool hebrew)+ {+ var t = hebrew ? He : En;+ var rules = SyntheticWorkshopRules.FromCatalogue(C03.Gdd03Balance!);+ var paused = new Cause("city", City, 0, "Haifa: an arms workshop has no worker without a job this month", key: CauseKeys.WorkshopPaused, args: new[] { Workshops.NoWorker });+ using (var ui = new UiTestKit())+ {+ var (bridge, _) = Game(C03, t, edit: (s, id) =>+ {+ s.Workshops.Add(id, new Workshop(id, true, SyntheticWorkshopTier.Ordinary, rules.Price(SyntheticWorkshopTier.Ordinary), 1));+ var enemy = s.Units.Values.First(u => u.Side != "" && u.Side != Movement.PlayerSide);+ var home = C03.SettlementHexes.First(h => h.Id == City);+ var uid = s.NextId++;+ s.Units.Add(uid, new Unit(uid, enemy.Type, home.Q, home.R, side: enemy.Side, strength: enemy.Strength));+ }, last: g => new StepResult(g.State, new[] { paused }, Array.Empty<Rejection>()));+ using var panel = Panel(ui, bridge, t);+ var (q, r) = Hex(C03);+ panel.Show(q, r);+ Assert.AreEqual(t.Format("city.workshops_staffed", 1, 1), ui.Q<Label>("city-workshops").text);+ Assert.AreEqual(t["city.workshop_staffed"], ui.Q<Label>("city-workshop-state").text);+ Assert.AreEqual(t.Format("city.workshop_cycle", 1, rules.StaffedTurns, PlayerText.Money(C03, "treasury", (double)rules.Price(SyntheticWorkshopTier.Ordinary))),+ ui.Q<Label>("city-workshop-cycle").text);+ Assert.IsTrue(Cities.Held(C03, bridge.State).Contains(City), "precondition: the enemy holds Haifa");+ Assert.AreEqual(t.Format("city.workshop_held", hebrew ? TownsHe[City] : Towns[City]), ui.Q<Label>("city-workshop-held").text);+ Assert.AreEqual(CauseText.Line(paused, C03, Array.Empty<Statecraft.Game.Map.Units.UnitEntry>(), t, TownsHe), ui.Q<Label>("city-workshop-paused-0").text);+ }+ using (var ui = new UiTestKit())+ {+ var (bridge, _) = Game(C03, t, edit: (s, id) => s.Workshops.Add(id, new Workshop(id, false, SyntheticWorkshopTier.Ordinary)));+ using var panel = Panel(ui, bridge, t);+ var (q, r) = Hex(C03);+ panel.Show(q, r);+ Assert.AreEqual(t["city.workshop_unstaffed"], ui.Q<Label>("city-workshop-state").text);+ Assert.AreEqual(t.Format("city.workshop_next", PlayerText.Money(C03, "treasury", (double)rules.Price(SyntheticWorkshopTier.Ordinary))),+ ui.Q<Label>("city-workshop-cycle").text);+ Assert.IsNull(ui.Root.Q("city-workshop-held"), "Haifa is not held");+ Assert.IsNull(ui.Root.Q("city-workshop-paused-0"), "no turn has run: no pause to report");+ }+ }+}diff --git a/unity/Assets/Tests/EditMode/SimBridgeGuardTests.cs b/unity/Assets/Tests/EditMode/SimBridgeGuardTests.csindex ee520842e..0931f8497 100644--- a/unity/Assets/Tests/EditMode/SimBridgeGuardTests.cs+++ b/unity/Assets/Tests/EditMode/SimBridgeGuardTests.cs@@ -75,6 +75,18 @@ public class SimBridgeGuardTests}}+ /// <summary>#1722 (R-ARMS-005): AssignWorkers is keyed by city and role, so a workshop staffing order and a jobs order for+ /// the same city keep their own slots, while a second order of one role for one city still replaces the first.</summary>+ [Test]+ public void AssignWorkersIsKeyedByCityAndRole()+ {+ var job = new AssignWorkers("tel_aviv", "job", 1);+ Assert.AreNotEqual(SimBridge.Key(job), SimBridge.Key(new AssignWorkers("tel_aviv", Workshops.Role, 1)), "the two roles");+ Assert.AreNotEqual(SimBridge.Key(job), SimBridge.Key(new AssignWorkers("jerusalem", "job", 1)), "two cities");+ Assert.AreEqual(SimBridge.Key(job), SimBridge.Key(new AssignWorkers("tel_aviv", "job", 5)), "one role, one city: the later order replaces it");+ Assert.AreEqual(SimBridge.Key(new AssignWorkers("tel_aviv", Workshops.Role, 0)), SimBridge.Key(new AssignWorkers("tel_aviv", Workshops.Role, 2)));+ }+[Test]public void NoCommandTypeFallsToTheDefaultBranch(){diff --git a/unity/Assets/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yamlindex 854991b9c..e59c68a01 100644--- a/unity/Assets/UI/strings.en.yaml+++ b/unity/Assets/UI/strings.en.yaml@@ -797,6 +797,21 @@ city.resource.vineyards: "vineyards"city.project_reason.turn_cap: "No more than {0} city projects in one turn"# The toggle that folds a city's own projects on a stacked bar or a short window (owner ruling on #1150).city.projects_toggle: "City projects ({0})"+# #1722 slice E (#1701; R-ARMS-005 to R-ARMS-007), gdd-0.3 only: a built arms workshop's part of the info panel. The+# stepper's {0} is the city's staffed (or ordered) workshops, {1} its built ones; the cycle's {0} its staffed months,+# {1} workshop.staffed_turns, {2} the Money paid; city.workshop_held's {0} the city.+city.workshops_staffed: "Arms workshops staffed: {0} of {1}"+city.workshops_ordered: "Arms workshops staffed at End turn: {0} of {1}"+city.workshop_staffed: "This workshop: staffed"+city.workshop_unstaffed: "This workshop: not staffed, paused"+city.workshop_cycle: "Cycle: {0} of {1} staffed months · paid {2}"+city.workshop_next: "No cycle under way · next cycle: {0}"+city.workshop_held: "Paused: the enemy holds {0}"+# A workshop staffing order's refusals (R-ARMS-005): the sim's own English (Workshops.Refused*), {0} the city, {1} a count.+workshop.refused_built_one: "{0} has 1 arms workshop"+workshop.refused_built: "{0} has {1} arms workshops"+workshop.refused_people: "{0} has {1} civilians and craftsmen"+workshop.refused_people_no_job: "{0} has {1} civilians and craftsmen without a job"site.available: "A designated site for a new yishuv"site.group: "halutz group {0}"site.build: "Build a yishuv with {0}: {1}, {2}"diff --git a/unity/Assets/UI/strings.he.yaml b/unity/Assets/UI/strings.he.yamlindex 7838de3a3..321f22498 100644--- a/unity/Assets/UI/strings.he.yaml+++ b/unity/Assets/UI/strings.he.yaml@@ -877,6 +877,22 @@ city.project_reason.turn_cap: "אי אפשר להתחיל יותר מ־{0} מי# The toggle that folds a city's own projects on a stacked bar or a short window (owner ruling on #1150), {0} the# number of kinds. For the native reviewer (#564).city.projects_toggle: "מיזמי העיר ({0})"+# #1722 slice E (#1701; R-ARMS-005 to R-ARMS-007), gdd-0.3 only: a built arms workshop's part of the info panel, as in+# strings.en.yaml. Counts as "Label: N" (HE-04); the refusals follow unit.reinforce_refused.idle. Agent-drafted Hebrew;+# native review pending (#564).+city.workshops_staffed: "סדנאות נשק מאוישות: {0} מתוך {1}"+city.workshops_ordered: "סדנאות נשק מאוישות בסיום התור: {0} מתוך {1}"+city.workshop_staffed: "הסדנה הזאת: מאוישת"+city.workshop_unstaffed: "הסדנה הזאת: לא מאוישת, בהמתנה"+city.workshop_cycle: "חודשים מאוישים במחזור: {0} מתוך {1} · שולם: {2}"+city.workshop_next: "אין מחזור עבודה פעיל · עלות המחזור הבא: {0}"+city.workshop_held: "בהמתנה: {0} בשליטת האויב"+workshop.refused_built_one: "{0}: יש רק סדנת נשק אחת"+workshop.refused_built: "{0}: סדנאות נשק בנויות: {1}"+# A no-break space (U+00A0) joins "יש" to its count, so a narrow panel never wraps "(יש" and "0)" apart.+# Agent-drafted Hebrew; native review pending (#564).+workshop.refused_people: "{0}: אין די אזרחים ובעלי מלאכה (יש\u00A0{1})"+workshop.refused_people_no_job: "{0}: אין די אזרחים ובעלי מלאכה ללא משרה (יש\u00A0{1})"site.available: "אתר ייעודי ליישוב חדש"site.group: "קבוצת חלוצים {0}"site.build: "הקמת יישוב עם {0}: {1}, {2}"