diff --git a/core/src/com/unciv/logic/map/TileInfo.kt b/core/src/com/unciv/logic/map/TileInfo.kt index f56164ca99..e1f373e31e 100644 --- a/core/src/com/unciv/logic/map/TileInfo.kt +++ b/core/src/com/unciv/logic/map/TileInfo.kt @@ -750,7 +750,8 @@ open class TileInfo { out.add("Terrain feature [$terrainFeature] does not exist in ruleset!") if (resource != null && !ruleset.tileResources.containsKey(resource)) out.add("Resource [$resource] does not exist in ruleset!") - if (improvement != null && !ruleset.tileImprovements.containsKey(improvement)) + if (improvement != null && !improvement!!.startsWith(TileMap.startingLocationPrefix) + && !ruleset.tileImprovements.containsKey(improvement)) out.add("Improvement [$improvement] does not exist in ruleset!") return out } diff --git a/core/src/com/unciv/logic/map/TileMap.kt b/core/src/com/unciv/logic/map/TileMap.kt index a66142b788..ea9337f461 100644 --- a/core/src/com/unciv/logic/map/TileMap.kt +++ b/core/src/com/unciv/logic/map/TileMap.kt @@ -374,11 +374,17 @@ class TileMap { * Is run before setTransients, so make do without startingLocationsByNation */ fun getRulesetIncompatibility(ruleset: Ruleset): HashSet { - setTransients(ruleset) - setStartingLocationsTransients() val rulesetIncompatibilities = HashSet() for (set in values.map { it.getRulesetIncompatibility(ruleset) }) rulesetIncompatibilities.addAll(set) + + // All the rest is to find missing nations + try { // This can fail if the map contains a resource that isn't in the ruleset, in TileInfo.tileResource + setTransients(ruleset) + } catch (ex: Exception) { + return rulesetIncompatibilities + } + setStartingLocationsTransients() for ((_, nationName) in startingLocations) { if (nationName !in ruleset.nations) rulesetIncompatibilities.add("Nation [$nationName] does not exist in ruleset!")