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

This commit is contained in:
Yair Morgenstern 2018-07-01 17:16:56 +03:00
parent 67b9b7ea7a
commit f08261edaf
2 changed files with 7 additions and 4 deletions

View File

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

View File

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