Fixed crash when borrowing names (#4800)

* Fixed crash when borrowing names

* Fix potential mod error allowed by the previous fix
This commit is contained in:
Xander Lenstra 2021-08-07 22:44:16 +02:00 committed by GitHub
parent 9a24f04d56
commit 0c1a21f6ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -94,7 +94,7 @@ class Nation : INamed, ICivilopediaText {
disembarkCosts1 = uniques.contains("Units pay only 1 movement point to disembark")
}
lateinit var cities: ArrayList<String>
var cities: ArrayList<String> = arrayListOf()
/** Used only by NewGame Nation picker */

View File

@ -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)