From 5a78c612abd0d58c35fd537fd4126827a5296f65 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 27 Jan 2019 23:45:39 +0200 Subject: [PATCH] Fixed errors caused by AI civs not having any non-researched techs to choose from, when all techs are researched - now choose future tech again --- core/src/com/unciv/logic/automation/NextTurnAutomation.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/logic/automation/NextTurnAutomation.kt b/core/src/com/unciv/logic/automation/NextTurnAutomation.kt index 5af3364e37..4525f9cfdb 100644 --- a/core/src/com/unciv/logic/automation/NextTurnAutomation.kt +++ b/core/src/com/unciv/logic/automation/NextTurnAutomation.kt @@ -1,6 +1,5 @@ package com.unciv.logic.automation -import com.unciv.logic.city.CityInfo import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.civilization.PlayerType import com.unciv.logic.map.MapUnit @@ -85,6 +84,11 @@ class NextTurnAutomation{ val costs = techsGroups.keys.sorted() val tech: Technology + if (researchableTechs.isEmpty()) { // no non-researched techs available, go for future tech + civInfo.tech.techsToResearch.add("Future Tech") + return + } + val techsCheapest = techsGroups[costs[0]]!! //Do not consider advanced techs if only one tech left in cheapest groupe if (techsCheapest.size == 1 || costs.size == 1) { @@ -94,6 +98,7 @@ class NextTurnAutomation{ val techsAdvanced = techsGroups[costs[1]]!! tech = (techsCheapest + techsAdvanced).getRandom() } + civInfo.tech.techsToResearch.add(tech.name) } }