Buying techs now enables their uniques immediately - kudos ingvart!

This commit is contained in:
Yair Morgenstern
2018-12-19 19:20:57 +02:00
parent a1a2b89949
commit f19750409d
3 changed files with 4 additions and 6 deletions

View File

@ -31,7 +31,8 @@ class GameStarter{
for (nationName in GameBasics.Nations.keys.filterNot { it=="Barbarians" || it==newGameParameters.nation }.shuffled() for (nationName in GameBasics.Nations.keys.filterNot { it=="Barbarians" || it==newGameParameters.nation }.shuffled()
.take(newGameParameters.numberOfEnemies)) { .take(newGameParameters.numberOfEnemies)) {
val civ = CivilizationInfo(nationName) 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) gameInfo.civilizations.add(civ)
} }

View File

@ -101,7 +101,7 @@ class TechManager {
addTechnology(techName) addTechnology(techName)
} }
private fun addTechnology(techName:String) { fun addTechnology(techName:String) {
if(techName!="Future Tech") if(techName!="Future Tech")
techsToResearch.remove(techName) techsToResearch.remove(techName)

View File

@ -182,10 +182,7 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci
from.gold -= offer.amount from.gold -= offer.amount
} }
if (offer.type == TradeType.Technology) { if (offer.type == TradeType.Technology) {
to.tech.techsResearched.add(offer.name) to.tech.addTechnology(offer.name)
if (to.tech.techsToResearch.contains(offer.name)) {
to.tech.techsToResearch.remove(offer.name)
}
} }
if(offer.type== TradeType.City){ if(offer.type== TradeType.City){
val city = from.cities.first { it.name==offer.name } val city = from.cities.first { it.name==offer.name }