Can now handle units upgrading to units with no required tech

This commit is contained in:
Yair Morgenstern 2020-11-23 22:25:17 +02:00
parent 114effe1ae
commit 7b0bb55045
2 changed files with 3 additions and 3 deletions

View File

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

View File

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