From f08261edafaf61c573c1c80380f884d1ad6eff89 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 1 Jul 2018 17:16:56 +0300 Subject: [PATCH] Fixed bug where (I assume) if you started a game before version 94, then you may not have any techs at all, and so wwhen you try to fund the player's Era by techs, it finds nothing and explodes --- android/build.gradle | 4 ++-- core/src/com/unciv/logic/civilization/CivilizationInfo.kt | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 20f542511c..cda421a70e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,8 +21,8 @@ android { applicationId "com.unciv.game" minSdkVersion 14 targetSdkVersion 26 - versionCode 94 - versionName "2.5.8" + versionCode 95 + versionName "2.5.9" } buildTypes { release { diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt index 1350bd450e..f0eaf7a6cf 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt @@ -237,9 +237,12 @@ class CivilizationInfo { fun isDefeated()= cities.isEmpty() && !getCivUnits().any{it.name=="Settler"} fun getEra(): TechEra { - return tech.techsResearched.map { GameBasics.Technologies[it]!! } + + val maxEraOfTech = tech.techsResearched.map { GameBasics.Technologies[it]!! } .map { it.era() } - .max()!! + .max() + if(maxEraOfTech!=null) return maxEraOfTech + else return TechEra.Ancient } }