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.

UI: city panel shows overflow and craftsmen from the sim (fixes #1121) (#1132)

Beri2d8236d52158
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 264934413..f31779abf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,10 @@ checks this (see `CONTRIBUTING.md`).
## [Unreleased]
### Added
+- The city panel in the GDD loop shows the city's overflow, the people beyond its housing (`Cities.Overflow`,
+ R-HOUSE-002), beside the refugees waiting, and its trained craftsmen (`City.Craftsmen`, R-CRAFT-001) beside the jobs,
+ in English and Hebrew; both numbers are the sim's, and each pair shares a row so the panel stays clear of the left
+ column on a short window (fixes #1121).
- The IDF brigades' 15 May 1948 strengths in `content/map/units_1948.yaml` (the first step of GDD Phase 5 PR 4, refs
#743): the eight brigades with a size in the #906 research note (en.wiki's brigade table, citing Ben-Gurion's War
Diaries) carry it, cite it and are `status: to_verify` until a primary source replaces it (owner, 20 October 2026).
diff --git a/unity/Assets/Scripts/UI/GddHexPanel.cs b/unity/Assets/Scripts/UI/GddHexPanel.cs
index 60b8258cd..569b24768 100644
--- a/unity/Assets/Scripts/UI/GddHexPanel.cs
+++ b/unity/Assets/Scripts/UI/GddHexPanel.cs
@@ -8,7 +8,7 @@ namespace Statecraft.Game.UI
{
/// <summary>GDD Phase 1 PR 8 (#381): the info panel's part for the GDD loop (Content.IsGdd), built into the
/// <see cref="HostName"/> element on every render.
- /// <para>On a city hex (State.Cities), its counts (housing, jobs, refugees waiting, recruits) and training cohorts with
+ /// <para>On a city hex (State.Cities), its counts (housing, overflow, jobs, craftsmen, refugees waiting, recruits) and training cohorts with
/// their turns left, the Assign stepper (R-CITY-001), Train for each facility the city has (R-TRAIN-001, R-CAMP-001) and Cancel
/// (R-TRAIN-002). On a yishuv site's hex (sites.yaml, Projects.IsYishuvSite), its state, and Build with each idle pioneer
/// group (Projects.IsPioneer: a halutz or a veteran one), with the rules' cost and the unit's own turns (Projects.TurnsToBuild;
@@ -19,7 +19,7 @@ namespace Statecraft.Game.UI
public static class GddHexPanel
{
public const string HostName = "info-gdd";
- const string LineClass = "info-gdd-line", RowClass = "info-gdd-row";
+ const string LineClass = "info-gdd-line", RowClass = "info-gdd-row", PairsClass = "info-gdd-pairs";
public static void Hide(VisualElement host) { host.Clear(); host.style.display = DisplayStyle.None; }
@@ -55,8 +55,16 @@ namespace Statecraft.Game.UI
Line(host, "city-housing", city.Condition is double condition
? text.Format("city.housing_condition", housed, capacity, PlayerText.Percent(condition))
: text.Format("city.housing", housed, capacity));
- Line(host, "city-jobs", text.Format("city.jobs", city.Employed, city.JobSlots));
- Line(host, "city-refugees", text.Format("city.refugees", Groups(text, city.Refugees)));
+ // #1121: the craftsmen (R-CRAFT-001) beside Jobs, as they fill ordinary jobs (R-CRAFT-002), and the overflow
+ // (R-HOUSE-002, Cities.Overflow) beside the refugees waiting, the other people without housing. Each pair shares a
+ // row (the labels keep their width and the row wraps only when they do not fit, Statecraft.uss), so on a short
+ // window the panel stays clear of the left column (InfoPanelLayoutTests). Bare counts, like the Jobs line, to fit.
+ var jobs = Row(host, "city-jobs-row"); jobs.AddToClassList(PairsClass);
+ Line(jobs, "city-jobs", text.Format("city.jobs", city.Employed, city.JobSlots));
+ Line(jobs, "city-craftsmen", text.Format("city.craftsmen", city.Craftsmen));
+ var waiting = Row(host, "city-waiting-row"); waiting.AddToClassList(PairsClass);
+ Line(waiting, "city-refugees", text.Format("city.refugees", Groups(text, city.Refugees)));
+ Line(waiting, "city-overflow", text.Format("city.overflow", Cities.Overflow(s, city)));
Line(host, "city-recruits", text.Format("city.recruits", Groups(text, city.Recruits)));
// The Assign stepper: the ordered count (or the current one), one group a press, within R-CITY-001's limits as
diff --git a/unity/Assets/Tests/EditMode/CityPanelTests.cs b/unity/Assets/Tests/EditMode/CityPanelTests.cs
index d17900511..fac157d56 100644
--- a/unity/Assets/Tests/EditMode/CityPanelTests.cs
+++ b/unity/Assets/Tests/EditMode/CityPanelTests.cs
@@ -55,15 +55,20 @@ public class CityPanelTests
[Test]
public void TheCityHexShowsItsCountsFromTheSim()
{
+ // #1121: 4 civilians over the housing and 3 craftsmen trained (housed too, R-HOUSE-003) are 7 groups of overflow
+ // (R-HOUSE-002), so both new lines read nonzero sim values.
using var ui = new UiTestKit();
- var bridge = Bridge(En);
+ var bridge = Bridge(En, s => { var x = s.Cities[City]; s.Cities[City] = x.WithCounts(x.HousingCapacity + 4, x.Employed, x.Refugees).WithCraftsmen(3); });
using var panel = Panel(ui, bridge, En);
panel.Show(CityHex.q, CityHex.r);
var city = bridge.State.Cities[City];
Assert.AreEqual((0, 0), (city.Refugees, city.Recruits), "precondition: no refugees or recruits at the start (the plural forms below)");
+ Assert.AreEqual((7, 3), (Cities.Overflow(bridge.State, city), city.Craftsmen), "precondition: the sim's overflow and craftsmen");
Assert.AreEqual(DisplayStyle.Flex, Host(ui).style.display.value, "the GDD part of the panel shows");
Assert.AreEqual(En.Format("city.housing_condition", Cities.Housed(bridge.State, city), En.Format("city.groups", city.HousingCapacity), PlayerText.Percent(city.Condition!.Value)), ui.Q<Label>("city-housing").text);
+ Assert.AreEqual(En.Format("city.overflow", 7), ui.Q<Label>("city-overflow").text);
Assert.AreEqual(En.Format("city.jobs", city.Employed, city.JobSlots), ui.Q<Label>("city-jobs").text);
+ Assert.AreEqual(En.Format("city.craftsmen", 3), ui.Q<Label>("city-craftsmen").text);
Assert.AreEqual(En.Format("city.refugees", En.Format("city.groups", city.Refugees)), ui.Q<Label>("city-refugees").text);
Assert.AreEqual(En.Format("city.recruits", En.Format("city.groups", city.Recruits)), ui.Q<Label>("city-recruits").text);
Assert.AreEqual(En.Format("city.workers", En.Format("city.groups", city.Employed)), ui.Q<Label>("city-workers").text);
diff --git a/unity/Assets/UI/Statecraft.uss b/unity/Assets/UI/Statecraft.uss
index 75e4b855f..787fecd00 100644
--- a/unity/Assets/UI/Statecraft.uss
+++ b/unity/Assets/UI/Statecraft.uss
@@ -351,6 +351,9 @@ Button:disabled { color: var(--ink-dim); border-color: rgba(120, 120, 120, 0.4);
.info-gdd-line { font-size: 17px; flex-shrink: 1; }
.info-gdd-row { flex-wrap: wrap; align-items: center; }
.info-gdd Button { margin: 2px 6px 2px 0; font-size: 17px; white-space: normal; flex-shrink: 1; }
+/* Two counts on one row (Jobs | Craftsmen, Refugees waiting | Overflow; #1121): each keeps its width, so the row wraps
+ whole rather than squeezing a line into two, and a gap follows each (mirrored in Hebrew). */
+.info-gdd-pairs > .info-gdd-line { flex-shrink: 0; margin-right: 14px; }
/* Before a hex is chosen only the hint shows (InfoPanelPresenter sets info-empty): a one-line chip that hugs its text, as
the promo shows no panel until a tile is chosen (HUD round 1, #398). */
.info-panel.info-empty { min-height: 0; width: auto; padding: 8px 16px; }
@@ -855,5 +858,6 @@ Button.settings-choice-selected { -unity-font-definition: url("project://databas
rules above at equal specificity. */
.lang-he .info-gdd { margin-left: 0; padding-left: 0; border-left-width: 0; margin-right: 14px; padding-right: 14px; border-right-width: 1px; }
.lang-he .info-gdd Button { margin: 2px 0 2px 6px; }
+.lang-he .info-gdd-pairs > .info-gdd-line { margin-right: 0; margin-left: 14px; }
.hud-two-row .info-panel.info-gdd-shown { width: 520px; flex-wrap: wrap; }
.hud-two-row .info-gdd { width: 100%; margin: 8px 0 0 0; padding: 8px 0 0 0; border-left-width: 0; border-right-width: 0; border-top-width: 1px; }
diff --git a/unity/Assets/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yaml
index ee341af30..8ecdea32b 100644
--- a/unity/Assets/UI/strings.en.yaml
+++ b/unity/Assets/UI/strings.en.yaml
@@ -356,7 +356,9 @@ save.write_failed: "Your game could not be saved."
# designated site's state and Build/Stop. {0}, {1}: numbers from the sim (State.Cities, unit_types.yaml, rules.yaml mvp).
city.housing: "Housing: {0} of {1}"
city.housing_condition: "Housing: {0} of {1}, condition {2}"
+city.overflow: "Overflow: {0}"
city.jobs: "Jobs: {0} of {1} filled"
+city.craftsmen: "Craftsmen: {0}"
city.refugees: "Refugees waiting: {0}"
city.recruits: "Recruits: {0}"
city.workers: "In work: {0}"
diff --git a/unity/Assets/UI/strings.he.yaml b/unity/Assets/UI/strings.he.yaml
index a108695c4..00d42f0da 100644
--- a/unity/Assets/UI/strings.he.yaml
+++ b/unity/Assets/UI/strings.he.yaml
@@ -369,7 +369,13 @@ save.write_failed: "לא ניתן היה לשמור את המשחק."
# The info panel in the GDD loop (GddHexPanel, #381); the GDD's Hebrew for Halutz (חלוץ) and Hakhshara (הכשרה).
city.housing: "דיור: {0} מתוך {1}"
city.housing_condition: "דיור: {0} מתוך {1}, מצב {2}"
+# The people beyond the city's housing, in groups (R-HOUSE-002, #1121): new wording, no approved term. For the native
+# reviewer (#564).
+city.overflow: "חריגה מהדיור: {0}"
city.jobs: "משרות: {0} מתוך {1} מאוישות"
+# The approved word for craftsman, בעל מלאכה (Q-UI-2, #375), in the plural, with a count of groups (#1121). For the
+# native reviewer (#564).
+city.craftsmen: "בעלי מלאכה: {0}"
city.refugees: "פליטים ממתינים: {0}"
city.recruits: "מגויסים: {0}"
city.workers: "בעבודה: {0}"