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.

fix(ui,map): minimap sized to its picture, click gate first and terrain-only raycast, raycast tests

eyalgolan7cdc149604c3
diff --git a/unity/Assets/Scripts/Map/HexPicker.cs b/unity/Assets/Scripts/Map/HexPicker.cs
index 33f34735d..0d7b20d3b 100644
--- a/unity/Assets/Scripts/Map/HexPicker.cs
+++ b/unity/Assets/Scripts/Map/HexPicker.cs
@@ -10,7 +10,7 @@ namespace Statecraft.Game.Map
{
public const double KmPerDegLat = 110.57, KmPerDegLonEq = 111.32; // tools/geo.py
- public static double KmPerDegLon(double lat0, double lat1) => KmPerDegLonEq * Math.Cos((lat0 + lat1) / 2 * Math.PI / 180);
+ public static double KmPerDegLon(double lat0, double lat1) => KmPerDegLonEq * Math.Cos((lat0 + lat1) / 2 * (Math.PI / 180)); // x * (pi/180) is how Python's math.radians computes it, bit for bit
public static (int q, int r) FromLonLat(double lon, double lat, HexBounds b, double hexSizeKm)
{
diff --git a/unity/Assets/Scripts/Map/MapPointer.cs b/unity/Assets/Scripts/Map/MapPointer.cs
index 28225b6dd..d7dffa8e2 100644
--- a/unity/Assets/Scripts/Map/MapPointer.cs
+++ b/unity/Assets/Scripts/Map/MapPointer.cs
@@ -24,10 +24,12 @@ namespace Statecraft.Game.Map
/// uses), otherwise the hex under the pointer is raised as HexClicked. Returns whether a hex was picked.</summary>
public bool HandleClick(Vector2 pos)
{
+ if (IsOverUi != null && IsOverUi(pos)) return false; // the UI is asked first, whatever else is missing
if (Map == null || Map.Terrain == null) return false;
- if (IsOverUi != null && IsOverUi(pos)) return false;
var cam = Camera.main;
- if (cam == null || !Physics.Raycast(cam.ScreenPointToRay(pos), out var hit, 1_000_000f)) return false;
+ var collider = Map.Terrain.GetComponent<TerrainCollider>();
+ // only the terrain's own collider: other colliders (markers, future props) never decide which hex is clicked
+ if (cam == null || collider == null || !collider.Raycast(cam.ScreenPointToRay(pos), out var hit, 1_000_000f)) return false;
var hex = Pick(Map, hit.point);
HexClicked?.Invoke(hex.q, hex.r);
return true;
diff --git a/unity/Assets/Scripts/Map/MapScene.cs b/unity/Assets/Scripts/Map/MapScene.cs
index 6c1dcf398..bd8a902ba 100644
--- a/unity/Assets/Scripts/Map/MapScene.cs
+++ b/unity/Assets/Scripts/Map/MapScene.cs
@@ -68,6 +68,7 @@ namespace Statecraft.Game.Map
if (Application.isPlaying) { go.transform.SetParent(null); Destroy(go); } else DestroyImmediate(go);
}
Terrain = null;
+ Hexes = null;
}
}
}
diff --git a/unity/Assets/Scripts/UI/InfoPanelPresenter.cs b/unity/Assets/Scripts/UI/InfoPanelPresenter.cs
index a24615ff4..163d09bac 100644
--- a/unity/Assets/Scripts/UI/InfoPanelPresenter.cs
+++ b/unity/Assets/Scripts/UI/InfoPanelPresenter.cs
@@ -13,12 +13,15 @@ namespace Statecraft.Game.UI
{
readonly VisualElement panel; readonly SimBridge bridge; readonly UiText text;
readonly Button campButton, housingButton; readonly System.Action onCamp, onHousing;
+ readonly Label title, subtitle, settlements, placement, reason;
readonly IReadOnlyDictionary<string, string> settlementNames;
public InfoPanelPresenter(VisualElement root, SimBridge bridge, UiText text, IReadOnlyDictionary<string, string> settlementNames)
{
panel = root.Q<VisualElement>("info-panel"); this.bridge = bridge; this.text = text;
this.settlementNames = settlementNames;
+ title = panel.Q<Label>("info-title"); subtitle = panel.Q<Label>("info-subtitle"); settlements = panel.Q<Label>("info-settlements");
+ placement = panel.Q<Label>("info-placement"); reason = panel.Q<Label>("info-reason");
campButton = panel.Q<Button>("build-camp"); housingButton = panel.Q<Button>("build-housing");
onCamp = () => Build(MapActions.TransitCamp); onHousing = () => Build(MapActions.Housing);
campButton.clicked += onCamp; housingButton.clicked += onHousing;
@@ -43,31 +46,32 @@ namespace Statecraft.Game.UI
public void Render()
{
var c = bridge.Content; var s = bridge.State;
- var camp = panel.Q<Button>("build-camp"); var housing = panel.Q<Button>("build-housing");
+ var camp = campButton; var housing = housingButton;
if (Selected == null)
{
- panel.Q<Label>("info-title").text = text["info.hint"];
- foreach (var name in new[] { "info-subtitle", "info-settlements", "info-placement", "info-reason" }) panel.Q<Label>(name).text = "";
+ title.text = text["info.hint"];
+ subtitle.text = settlements.text = placement.text = reason.text = "";
camp.style.display = DisplayStyle.None; housing.style.display = DisplayStyle.None;
return;
}
var (q, r) = Selected.Value;
var hex = c.HexAt(q, r);
var owned = c.SettlementHexes.Where(x => x.Q == q && x.R == r).Select(x => settlementNames.TryGetValue(x.Id, out var n) ? n : x.Id).ToList();
- panel.Q<Label>("info-title").text = owned.Count > 0 ? owned[0] : hex == null ? text["info.off_map"] : text["info.biome." + hex.Biome];
- panel.Q<Label>("info-subtitle").text = hex == null ? "" : text.Format("info.hex", text["info.biome." + hex.Biome], q, r, hex.ElevM);
- panel.Q<Label>("info-settlements").text = owned.Count > 0 ? text.Format("info.owned", string.Join(", ", owned)) : "";
+ title.text = owned.Count > 0 ? owned[0] : hex == null ? text["info.off_map"] : text["info.biome." + hex.Biome];
+ subtitle.text = hex == null ? "" : text.Format("info.hex", text["info.biome." + hex.Biome], q, r, hex.ElevM);
+ settlements.text = owned.Count > 0 ? text.Format("info.owned", string.Join(", ", owned)) : "";
var here = MapActions.At(s, q, r);
var queued = bridge.QueuedLike(new MapAction(MapActions.Housing, q, r)) as MapAction;
- panel.Q<Label>("info-placement").text = queued != null ? text.Format("info.queued", text["info." + queued.Action])
+ placement.text = queued != null ? text.Format("info.queued", text["info." + queued.Action])
: here != null ? text.Format("info.built", text["info." + here.Action], here.Date) : "";
var campWhy = MapActions.Check(c, s, MapActions.TransitCamp, q, r);
var housingWhy = MapActions.Check(c, s, MapActions.Housing, q, r);
camp.style.display = DisplayStyle.Flex; housing.style.display = DisplayStyle.Flex;
camp.SetEnabled(campWhy == null); housing.SetEnabled(housingWhy == null);
- camp.text = text.Format("info.build_camp", c.Rules.MapActions.TryGetValue(MapActions.TransitCamp, out var cr) ? cr.Cost : 0);
- housing.text = text.Format("info.build_housing", c.Rules.MapActions.TryGetValue(MapActions.Housing, out var hr) ? hr.Cost : 0);
- panel.Q<Label>("info-reason").text = string.Join("\n", new[] { campWhy, housingWhy }.Where(x => x != null).Distinct()); // the sim's reasons, each once
+ // with no rule for an action there is no cost to show (it is disabled with the sim's reason anyway)
+ camp.text = c.Rules.MapActions.TryGetValue(MapActions.TransitCamp, out var cr) ? text.Format("info.build_camp", cr.Cost) : text["info.build_camp_plain"];
+ housing.text = c.Rules.MapActions.TryGetValue(MapActions.Housing, out var hr) ? text.Format("info.build_housing", hr.Cost) : text["info.build_housing_plain"];
+ reason.text = string.Join("\n", new[] { campWhy, housingWhy }.Where(x => x != null).Distinct()); // the sim's reasons, each once
}
}
}
diff --git a/unity/Assets/Scripts/UI/MinimapPresenter.cs b/unity/Assets/Scripts/UI/MinimapPresenter.cs
index 9cd39b509..8ae8c3c66 100644
--- a/unity/Assets/Scripts/UI/MinimapPresenter.cs
+++ b/unity/Assets/Scripts/UI/MinimapPresenter.cs
@@ -13,7 +13,7 @@ namespace Statecraft.Game.UI
{
public const int Width = 128;
public static readonly Color Sea = MapBuilder.BiomeColours["sea"];
- readonly VisualElement image, view; readonly HexFile hexes;
+ readonly VisualElement box, image, view; readonly HexFile hexes;
readonly double widthKm, lengthKm;
public Texture2D Texture { get; }
@@ -27,15 +27,37 @@ namespace Statecraft.Game.UI
widthKm = (b.lon1 - b.lon0) * HexPicker.KmPerDegLon(b.lat0, b.lat1);
lengthKm = (b.lat1 - b.lat0) * HexPicker.KmPerDegLat;
Texture = Paint(hexes, Width, (int)Math.Round(Width * lengthKm / widthKm));
- var box = root.Q<VisualElement>("minimap");
+ box = root.Q<VisualElement>("minimap");
image = box.Q<VisualElement>("minimap-image");
view = box.Q<VisualElement>("minimap-view");
image.style.backgroundImage = new StyleBackground(Texture);
image.RegisterCallback<PointerDownEvent>(OnPointerDown);
+ box.RegisterCallback<GeometryChangedEvent>(OnBoxGeometry);
+ FitImage();
+ }
+
+ /// <summary>The largest size with the picture's aspect that fits the container (scale-to-fit would draw the picture
+ /// smaller than its element and leave a strip that clicks and the view frame would still count as map).</summary>
+ public static Vector2 Fit(float containerWidth, float containerHeight, float aspect)
+ {
+ if (!(containerWidth > 0) || !(containerHeight > 0) || !(aspect > 0)) return Vector2.zero;
+ return containerWidth / containerHeight > aspect ? new Vector2(containerHeight * aspect, containerHeight) : new Vector2(containerWidth, containerWidth / aspect);
+ }
+
+ void OnBoxGeometry(GeometryChangedEvent e) => FitImage();
+
+ // The picture's element is exactly as big as the picture, so (0..1, 0..1) in the element is the whole map.
+ void FitImage()
+ {
+ var size = Fit(box.contentRect.width, box.contentRect.height, (float)Texture.width / Texture.height);
+ if (size == Vector2.zero) return;
+ image.style.width = size.x; image.style.height = size.y;
}
void OnPointerDown(PointerDownEvent e)
{
+ if (e.button != 0) return; // only the left button
+ if (!(image.layout.width > 0) || !(image.layout.height > 0)) return; // before layout (or NaN) there is no map to click
var (lon, lat) = ToLonLat(e.localPosition.x / image.layout.width, e.localPosition.y / image.layout.height);
Clicked?.Invoke(lon, lat);
}
@@ -73,14 +95,18 @@ namespace Statecraft.Game.UI
var (lon, lat) = frame.ToLonLat(lookAt);
var b = hexes.bounds;
float u = (float)((lon - b.lon0) / (b.lon1 - b.lon0)), v = (float)((b.lat1 - lat) / (b.lat1 - b.lat0));
- float w = (float)(1.5 * distanceM / 1000 / widthKm), h = (float)(1.0 * distanceM / 1000 / lengthKm);
- view.style.left = Length.Percent((u - w / 2) * 100); view.style.top = Length.Percent((v - h / 2) * 100);
+ float w = Mathf.Min(1f, (float)(1.5 * distanceM / 1000 / widthKm)), h = Mathf.Min(1f, (float)(1.0 * distanceM / 1000 / lengthKm));
+ // the frame is clamped inside the picture, which is the whole element
+ float left = Mathf.Clamp(u - w / 2, 0f, 1f - w), top = Mathf.Clamp(v - h / 2, 0f, 1f - h);
+ view.style.left = Length.Percent(left * 100); view.style.top = Length.Percent(top * 100);
view.style.width = Length.Percent(w * 100); view.style.height = Length.Percent(h * 100);
}
public void Dispose()
{
image.UnregisterCallback<PointerDownEvent>(OnPointerDown);
+ box.UnregisterCallback<GeometryChangedEvent>(OnBoxGeometry);
+ image.style.backgroundImage = StyleKeyword.Null; // nothing may keep drawing a destroyed texture
if (Texture != null) Object.DestroyImmediate(Texture);
}
}
diff --git a/unity/Assets/Tests/EditMode/MapActionUiTests.cs b/unity/Assets/Tests/EditMode/MapActionUiTests.cs
index e7c290b03..b774e7cf8 100644
--- a/unity/Assets/Tests/EditMode/MapActionUiTests.cs
+++ b/unity/Assets/Tests/EditMode/MapActionUiTests.cs
@@ -9,6 +9,7 @@ using Statecraft.Sim;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
+using UnityEngine.TestTools;
using UnityEngine.UIElements;
public class MapActionUiTests
@@ -169,21 +170,164 @@ public class MapActionUiTests
Assert.AreEqual(MapActions.Check(C, bridge.State, MapActions.Housing, tlv.Q, tlv.R), ui.Q<Label>("info-reason").text);
}
- [Test]
- public void TheMinimapClicksAndFramesTheView()
+ [UnityTest]
+ public System.Collections.IEnumerator AClickOnTheMinimapMapsToTheDrawnMapNotTheLetterbox()
{
using var ui = new UiTestKit();
using var mini = new MinimapPresenter(ui.Root, Hexes);
+ var image = ui.Q<VisualElement>("minimap-image");
+ for (int i = 0; i < 30 && !(image.layout.width > 0 && Mathf.Abs(image.layout.width / image.layout.height - (float)mini.Texture.width / mini.Texture.height) < 0.01f); i++) yield return null;
+ Assert.Greater(image.layout.width, 0f);
+ // the element is exactly as big as the picture (aspect of the texture), so there is no unused strip inside it
+ Assert.AreEqual((float)mini.Texture.width / mini.Texture.height, image.layout.width / image.layout.height, 0.01f);
(double lon, double lat)? clicked = null;
mini.Clicked += (lon, lat) => clicked = (lon, lat);
- var (lon0, lat0) = mini.ToLonLat(0, 0);
- Assert.AreEqual(Hexes.bounds.lon0, lon0, 1e-9); Assert.AreEqual(Hexes.bounds.lat1, lat0, 1e-9); // top-left is north-west
- var (lon1, lat1) = mini.ToLonLat(1, 1);
- Assert.AreEqual(Hexes.bounds.lon1, lon1, 1e-9); Assert.AreEqual(Hexes.bounds.lat0, lat1, 1e-9);
- var f = new GeoFrame(Hexes.bounds.lon0, Hexes.bounds.lon1, Hexes.bounds.lat0, Hexes.bounds.lat1, 161530f, 431220f);
+ var b = Hexes.bounds;
+ // a click a quarter of the way across and a quarter of the way down the visible map
+ var local = new Vector2(image.layout.width * 0.25f, image.layout.height * 0.25f);
+ using (var e = PointerDownEvent.GetPooled(new Event { type = EventType.MouseDown, button = 0, mousePosition = image.LocalToWorld(local) }))
+ { e.target = image; image.SendEvent(e); }
+ Assert.IsNotNull(clicked);
+ Assert.AreEqual(b.lon0 + 0.25 * (b.lon1 - b.lon0), clicked!.Value.lon, 1e-6);
+ Assert.AreEqual(b.lat1 - 0.25 * (b.lat1 - b.lat0), clicked.Value.lat, 1e-6);
+ clicked = null;
+ using (var e = PointerDownEvent.GetPooled(new Event { type = EventType.MouseDown, button = 1, mousePosition = image.LocalToWorld(local) }))
+ { e.target = image; image.SendEvent(e); }
+ Assert.IsNull(clicked, "only the left button clicks");
+ }
+
+ [UnityTest]
+ public System.Collections.IEnumerator TheViewFrameLiesInsideTheDrawnMap()
+ {
+ using var ui = new UiTestKit();
+ using var mini = new MinimapPresenter(ui.Root, Hexes);
+ var image = ui.Q<VisualElement>("minimap-image");
+ for (int i = 0; i < 30 && !(image.layout.width > 0); i++) yield return null;
+ var b = Hexes.bounds;
+ var f = new GeoFrame(b.lon0, b.lon1, b.lat0, b.lat1, 161530f, 431220f);
mini.SetView(f, f.ToWorld(34.95, 31.95, 0), 20000f);
- Assert.AreEqual(LengthUnit.Percent, ui.Q<VisualElement>("minimap-view").style.left.value.unit);
- Assert.IsNull(clicked);
+ yield return null;
+ var view = ui.Q<VisualElement>("minimap-view");
+ Assert.AreEqual(LengthUnit.Percent, view.style.left.value.unit);
+ Assert.GreaterOrEqual(view.style.left.value.value, 0f);
+ Assert.GreaterOrEqual(view.style.top.value.value, 0f);
+ Assert.LessOrEqual(view.style.left.value.value + view.style.width.value.value, 100f);
+ Assert.LessOrEqual(view.style.top.value.value + view.style.height.value.value, 100f);
+ // a view at the very edge stays inside the picture
+ mini.SetView(f, f.ToWorld(b.lon0, b.lat0, 0), 20000f);
+ Assert.GreaterOrEqual(view.style.left.value.value, 0f);
+ Assert.GreaterOrEqual(view.style.top.value.value, 0f);
+ Assert.AreSame(image, view.parent, "the frame is positioned in the picture's own coordinates");
+ }
+
+ static MapScene BuildMap()
+ {
+ EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);
+ new GameObject("TestMainCamera") { tag = "MainCamera" }.AddComponent<Camera>();
+ var map = new GameObject("MapScene").AddComponent<MapScene>();
+ map.Configure(AssetDatabase.LoadAssetAtPath<Material>("Assets/Materials/Terrain.mat"),
+ AssetDatabase.LoadAssetAtPath<Material>("Assets/Materials/HexOverlay.mat"),
+ AssetDatabase.LoadAssetAtPath<Material>("Assets/Materials/SettlementMarker.mat"));
+ map.Build();
+ Physics.SyncTransforms();
+ return map;
+ }
+
+ static bool Down(MapScene map, double lon, double lat, out RaycastHit hit)
+ {
+ var from = map.Frame.ToWorld(lon, lat, 100_000f);
+ return map.Terrain.GetComponent<TerrainCollider>().Raycast(new Ray(from, Vector3.down), out hit, 200_000f);
+ }
+
+ [Test]
+ public void RaysDownOntoTheTerrainPickTheRightHexes()
+ {
+ var map = BuildMap();
+ try
+ {
+ var tlv = C.SettlementHexes.Single(s => s.Id == "tel_aviv");
+ var a = C.HexAt(tlv.Q, tlv.R)!;
+ Assert.IsTrue(Down(map, a.Lon, a.Lat, out var hit));
+ Assert.AreEqual((tlv.Q, tlv.R), MapPointer.Pick(map, hit.point), "Tel Aviv's hex centre");
+
+ // two points 200 m either side of the middle of the edge Tel Aviv's hex shares with its eastern neighbour
+ var b = C.HexAt(tlv.Q + 1, tlv.R)!;
+ var wa = map.Frame.ToWorld(a.Lon, a.Lat, 0); var wb = map.Frame.ToWorld(b.Lon, b.Lat, 0);
+ var mid = (wa + wb) / 2; var dir = (wb - wa).normalized;
+ foreach (var (side, expected) in new[] { (-1f, (tlv.Q, tlv.R)), (1f, (tlv.Q + 1, tlv.R)) })
+ {
+ var (lon, lat) = map.Frame.ToLonLat(mid + dir * 200f * side);
+ Assert.IsTrue(Down(map, lon, lat, out hit));
+ Assert.AreEqual(expected, MapPointer.Pick(map, hit.point), "side " + side);
+ }
+
+ Assert.IsTrue(Down(map, 34.30, 32.60, out hit));
+ var seaHex = MapPointer.Pick(map, hit.point);
+ Assert.IsFalse(C.HexAt(seaHex.q, seaHex.r)!.Land, "the Mediterranean");
+
+ var f = map.Frame; const double inset = 0.005;
+ foreach (var (lon, lat) in new[] { (f.Lon0 + inset, f.Lat0 + inset), (f.Lon1 - inset, f.Lat0 + inset), (f.Lon0 + inset, f.Lat1 - inset), (f.Lon1 - inset, f.Lat1 - inset) })
+ {
+ Assert.IsTrue(Down(map, lon, lat, out hit), $"a ray reaches the terrain at ({lon}, {lat})");
+ var corner = MapPointer.Pick(map, hit.point);
+ Assert.AreEqual(HexPicker.FromLonLat(lon, lat, map.Hexes.bounds, map.Hexes.hex_size_km), corner);
+ }
+ }
+ finally { EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single); }
+ }
+
+ [Test]
+ public void AClickOverTheUiNeverReachesTheMapAndOtherwiseHitsTheHexUnderTheCamera()
+ {
+ var map = BuildMap();
+ try
+ {
+ var tlv = C.SettlementHexes.Single(s => s.Id == "tel_aviv");
+ var hex = C.HexAt(tlv.Q, tlv.R)!;
+ var ground = map.Frame.ToWorld(hex.Lon, hex.Lat, 0);
+ var cam = Camera.main!;
+ cam.transform.position = new Vector3(ground.x, 50_000f, ground.z);
+ cam.transform.rotation = Quaternion.Euler(90, 0, 0);
+ cam.farClipPlane = 200_000f;
+ var pointer = new GameObject("Pointer").AddComponent<MapPointer>();
+ pointer.Map = map;
+ var picked = new System.Collections.Generic.List<(int, int)>();
+ pointer.HexClicked += (q, r) => picked.Add((q, r));
+ var centre = new Vector2(cam.pixelWidth / 2f, cam.pixelHeight / 2f);
+
+ pointer.IsOverUi = _ => false;
+ Assert.IsTrue(pointer.HandleClick(centre));
+ Assert.AreEqual(new[] { (tlv.Q, tlv.R) }, picked);
+
+ picked.Clear();
+ pointer.IsOverUi = _ => true;
+ Assert.IsFalse(pointer.HandleClick(centre));
+ Assert.IsEmpty(picked);
+
+ pointer.Map = null; // the UI is asked first, even with no map
+ bool asked = false; pointer.IsOverUi = _ => { asked = true; return true; };
+ Assert.IsFalse(pointer.HandleClick(centre));
+ Assert.IsTrue(asked);
+ }
+ finally { EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single); }
+ }
+
+ [Test]
+ public void AMissingRuleShowsNoFalseCost()
+ {
+ using var ui = new UiTestKit();
+ var bridge = At(new DateTime(1950, 8, 1));
+ var info = Panel(ui, bridge);
+ var tlv = C.SettlementHexes.Single(s => s.Id == "tel_aviv");
+ var rule = C.Rules.MapActions[MapActions.Housing];
+ C.Rules.MapActions.Remove(MapActions.Housing);
+ try
+ {
+ info.Show(tlv.Q, tlv.R);
+ Assert.AreEqual("Build housing", ui.Q<Button>("build-housing").text);
+ Assert.IsFalse(ui.Q<Button>("build-housing").enabledSelf);
+ }
+ finally { C.Rules.MapActions[MapActions.Housing] = rule; }
}
[Test]
@@ -203,22 +347,4 @@ public class MapActionUiTests
mini.Dispose();
Assert.IsTrue(tex == null, "the texture is destroyed");
}
-
- [Test]
- public void AClickOverTheUiNeverReachesTheMap()
- {
- var go = new GameObject("PointerTest");
- try
- {
- var pointer = go.AddComponent<MapPointer>();
- int hexClicks = 0;
- pointer.HexClicked += (q, r) => hexClicks++;
- pointer.IsOverUi = _ => true;
- Assert.IsFalse(pointer.HandleClick(new Vector2(10, 10)));
- Assert.AreEqual(0, hexClicks);
- pointer.IsOverUi = _ => false;
- Assert.IsFalse(pointer.HandleClick(new Vector2(10, 10)), "no map, camera or terrain: nothing is picked");
- }
- finally { UnityEngine.Object.DestroyImmediate(go); }
- }
}
diff --git a/unity/Assets/UI/Statecraft.uss b/unity/Assets/UI/Statecraft.uss
index 4440f8f6f..6dd50f90e 100644
--- a/unity/Assets/UI/Statecraft.uss
+++ b/unity/Assets/UI/Statecraft.uss
@@ -77,7 +77,7 @@ Button:disabled { color: var(--ink-dim); border-color: rgba(120, 120, 120, 0.4);
.draft { color: var(--down); -unity-font-definition: url("project://database/Assets/UI/Fonts/EBGaramond-SemiBold.ttf"); -unity-text-align: middle-center; }
.info-panel { position: absolute; left: 16px; bottom: 16px; width: 520px; min-height: 160px; }
.minimap { position: absolute; right: 16px; bottom: 16px; width: 300px; height: 340px; padding: 6px; }
-.minimap-image { flex-grow: 1; -unity-background-scale-mode: scale-to-fit; }
+.minimap-image { align-self: center; -unity-background-scale-mode: stretch-to-fill; } /* the element is sized to the picture's aspect by MinimapPresenter */
.minimap-view { position: absolute; border-color: var(--ink); border-width: 1px; }
/* Full screens (Cabinet, Budget, Defence, Why) open in the centre, one at a time. */
diff --git a/unity/Assets/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yaml
index 680cf6239..7bc8bdb11 100644
--- a/unity/Assets/UI/strings.en.yaml
+++ b/unity/Assets/UI/strings.en.yaml
@@ -75,6 +75,8 @@ info.transit_camp: "A transit camp"
info.housing: "A housing project"
info.build_camp: "Place a transit camp ({0:0.0}m)"
info.build_housing: "Build housing ({0:0.0}m)"
+info.build_camp_plain: "Place a transit camp"
+info.build_housing_plain: "Build housing"
info.biome.sea: "Sea"
info.biome.lake: "Lake"
info.biome.coastal_plain: "Coastal plain"