Resolved another crash caused by incorrect ruleset mod definitions

This commit is contained in:
Yair Morgenstern 2020-10-19 23:24:53 +03:00
parent bd810d3d0c
commit c7b1121fe4

View File

@ -115,8 +115,7 @@ class Nation : INamed {
private fun addUniqueBuildingsText(textList: ArrayList<String>, ruleset: Ruleset) {
for (building in ruleset.buildings.values
.filter { it.uniqueTo == name && "Will not be displayed in Civilopedia" !in it.uniques}) {
if (building.replaces == null) textList += building.getShortDescription(ruleset)
else {
if (building.replaces != null && ruleset.buildings.containsKey(building.replaces!!)) {
val originalBuilding = ruleset.buildings[building.replaces!!]!!
textList += building.name.tr() + " - " + "Replaces [${originalBuilding.name}]".tr()
@ -136,7 +135,9 @@ class Nation : INamed {
if (building.cityHealth != originalBuilding.cityHealth)
textList += " {City health} " + "[${building.cityHealth}] vs [${originalBuilding.cityHealth}]".tr()
textList += ""
}
} else if (building.replaces != null) {
textList += building.name.tr() + " - " + "Replaces [${building.replaces}], which is not found in the ruleset!".tr()
} else textList += building.getShortDescription(ruleset)
}
}