Resolved #12524 - only add city ruins improvements if they exist in the ruleset

This commit is contained in:
yairm210 2024-11-26 14:06:08 +02:00
parent 62480c5d92
commit 6b64bc6f1a
2 changed files with 5 additions and 2 deletions

View File

@ -353,7 +353,9 @@ class City : IsPartOfGameInfoSerialization, INamed {
if (isCapital()) civ.moveCapitalToNextLargest(null)
civ.cities = civ.cities.toMutableList().apply { remove(this@City) }
getCenterTile().setImprovement("City ruins")
if (getRuleset().tileImprovements.containsKey("City ruins"))
getCenterTile().setImprovement("City ruins")
// Edge case! What if a water unit is in a city, and you raze the city?
// Well, the water unit has to return to the water!

View File

@ -42,7 +42,8 @@ class BaseUnit : RulesetObject(), INonPerpetualConstruction {
var interceptRange = 0
var unitType: String = ""
val type by lazy { ruleset.unitTypes[unitType]!! }
val type by lazy { ruleset.unitTypes[unitType]
?: throw Exception("Unit $name has unit type $unitType which is not present in ruleset!") }
override var requiredTech: String? = null
var requiredResource: String? = null