From 7b0bb5504561f381acebec1d5f5f917e50869160 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 23 Nov 2020 22:25:17 +0200 Subject: [PATCH] Can now handle units upgrading to units with no required tech --- core/src/com/unciv/logic/map/MapUnit.kt | 3 ++- core/src/com/unciv/models/ruleset/Ruleset.kt | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/logic/map/MapUnit.kt b/core/src/com/unciv/logic/map/MapUnit.kt index 0b31ee359e..dbd711c93a 100644 --- a/core/src/com/unciv/logic/map/MapUnit.kt +++ b/core/src/com/unciv/logic/map/MapUnit.kt @@ -227,7 +227,8 @@ class MapUnit { var unit = baseUnit() // Go up the upgrade tree until you find the last one which is buildable - while (unit.upgradesTo!=null && civInfo.tech.isResearched(unit.getDirectUpgradeUnit(civInfo).requiredTech!!)) + while (unit.upgradesTo!=null && unit.getDirectUpgradeUnit(civInfo).requiredTech + .let { it==null || civInfo.tech.isResearched(it) }) unit = unit.getDirectUpgradeUnit(civInfo) return unit } diff --git a/core/src/com/unciv/models/ruleset/Ruleset.kt b/core/src/com/unciv/models/ruleset/Ruleset.kt index 3e93d2b069..253d67fd31 100644 --- a/core/src/com/unciv/models/ruleset/Ruleset.kt +++ b/core/src/com/unciv/models/ruleset/Ruleset.kt @@ -250,8 +250,7 @@ class Ruleset { for (promotion in unit.promotions) if (!unitPromotions.containsKey(promotion)) lines += "${unit.replaces} contains promotion $promotion which does not exist!" - if (unit.upgradesTo != null && units.containsKey(unit.upgradesTo!!) && units[unit.upgradesTo!!]!!.requiredTech == null) - lines += "${unit.name} upgrades to ${unit.upgradesTo} which has no required tech!" + } for (building in buildings.values) {