From 0c1a21f6ae6bcf48cbb4582a76976857febef198 Mon Sep 17 00:00:00 2001 From: Xander Lenstra <71121390+xlenstra@users.noreply.github.com> Date: Sat, 7 Aug 2021 22:44:16 +0200 Subject: [PATCH] Fixed crash when borrowing names (#4800) * Fixed crash when borrowing names * Fix potential mod error allowed by the previous fix --- core/src/com/unciv/models/ruleset/Nation.kt | 2 +- core/src/com/unciv/models/ruleset/Ruleset.kt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/models/ruleset/Nation.kt b/core/src/com/unciv/models/ruleset/Nation.kt index b5a253fd82..df664c9ce4 100644 --- a/core/src/com/unciv/models/ruleset/Nation.kt +++ b/core/src/com/unciv/models/ruleset/Nation.kt @@ -94,7 +94,7 @@ class Nation : INamed, ICivilopediaText { disembarkCosts1 = uniques.contains("Units pay only 1 movement point to disembark") } - lateinit var cities: ArrayList + var cities: ArrayList = arrayListOf() /** Used only by NewGame Nation picker */ diff --git a/core/src/com/unciv/models/ruleset/Ruleset.kt b/core/src/com/unciv/models/ruleset/Ruleset.kt index 37a72a7693..558508e2be 100644 --- a/core/src/com/unciv/models/ruleset/Ruleset.kt +++ b/core/src/com/unciv/models/ruleset/Ruleset.kt @@ -307,6 +307,12 @@ class Ruleset { if (building.requiredTech == null && building.cost == 0) lines += "${building.name} must either have an explicit cost or reference an existing tech!" } + + for (nation in nations.values) { + if (nation.cities.isEmpty() && !nation.isSpectator() && !nation.isBarbarian()) { + lines += "${nation.name} can settle cities, but has no city names!" + } + } if (!modOptions.isBaseRuleset) return CheckModLinksResult(warningCount, lines)