From f19750409d0a73dbbd1d6fb25b890f2963289e59 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 19 Dec 2018 19:20:57 +0200 Subject: [PATCH] Buying techs now enables their uniques immediately - kudos ingvart! --- core/src/com/unciv/GameStarter.kt | 3 ++- core/src/com/unciv/logic/civilization/TechManager.kt | 2 +- core/src/com/unciv/logic/trade/TradeLogic.kt | 5 +---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/core/src/com/unciv/GameStarter.kt b/core/src/com/unciv/GameStarter.kt index a0ce8abd66..ca49dc4d5f 100644 --- a/core/src/com/unciv/GameStarter.kt +++ b/core/src/com/unciv/GameStarter.kt @@ -31,7 +31,8 @@ class GameStarter{ for (nationName in GameBasics.Nations.keys.filterNot { it=="Barbarians" || it==newGameParameters.nation }.shuffled() .take(newGameParameters.numberOfEnemies)) { val civ = CivilizationInfo(nationName) - civ.tech.techsResearched.addAll(gameInfo.getDifficulty().aiFreeTechs) + for (tech in gameInfo.getDifficulty().aiFreeTechs) + civ.tech.addTechnology(tech) gameInfo.civilizations.add(civ) } diff --git a/core/src/com/unciv/logic/civilization/TechManager.kt b/core/src/com/unciv/logic/civilization/TechManager.kt index 43ea921b75..04dc390ed3 100644 --- a/core/src/com/unciv/logic/civilization/TechManager.kt +++ b/core/src/com/unciv/logic/civilization/TechManager.kt @@ -101,7 +101,7 @@ class TechManager { addTechnology(techName) } - private fun addTechnology(techName:String) { + fun addTechnology(techName:String) { if(techName!="Future Tech") techsToResearch.remove(techName) diff --git a/core/src/com/unciv/logic/trade/TradeLogic.kt b/core/src/com/unciv/logic/trade/TradeLogic.kt index d125761391..abccc618bc 100644 --- a/core/src/com/unciv/logic/trade/TradeLogic.kt +++ b/core/src/com/unciv/logic/trade/TradeLogic.kt @@ -182,10 +182,7 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci from.gold -= offer.amount } if (offer.type == TradeType.Technology) { - to.tech.techsResearched.add(offer.name) - if (to.tech.techsToResearch.contains(offer.name)) { - to.tech.techsToResearch.remove(offer.name) - } + to.tech.addTechnology(offer.name) } if(offer.type== TradeType.City){ val city = from.cities.first { it.name==offer.name }