Removed hydro plant from loaded games

This commit is contained in:
Yair Morgenstern 2018-10-28 16:37:51 +02:00
parent f86736db6d
commit 4423dadefd
5 changed files with 20 additions and 12 deletions

View File

@ -280,7 +280,7 @@
name:"Harbor", name:"Harbor",
maintenance:2, maintenance:2,
hurryCostModifier:25, hurryCostModifier:25,
uniques:["+1 production from all sea resources worked by the city","Connects trade routes over water"] uniques:["+1 production from all sea resources worked by the city","Connects trade routes over water"] // todo - trade routes over water!
requiredTech:"Compass" requiredTech:"Compass"
}, },
{ {

View File

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.game" applicationId "com.unciv.game"
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 26 targetSdkVersion 26
versionCode 151 versionCode 152
versionName "2.9.5" versionName "2.9.6"
} }
buildTypes { buildTypes {
release { release {

View File

@ -27,20 +27,16 @@ class UnCivGame : Game() {
GameBasics.run { } // just to initialize the GameBasics GameBasics.run { } // just to initialize the GameBasics
settings = GameSaver().getGeneralSettings() settings = GameSaver().getGeneralSettings()
if (GameSaver().getSave("Autosave").exists()) { if (GameSaver().getSave("Autosave").exists()) {
try { // try {
loadGame("Autosave") loadGame("Autosave")
} catch (ex: Exception) { // silent fail if we can't read the autosave // } catch (ex: Exception) { // silent fail if we can't read the autosave
startNewGame() // startNewGame()
} // }
} }
else startNewGame() // screen=LanguagePickerScreen() disabled because of people's negative reviews =( else startNewGame() // screen=LanguagePickerScreen() disabled because of people's negative reviews =(
} }
fun loadGame(gameInfo:GameInfo){ fun loadGame(gameInfo:GameInfo){
// As of 2.9.6, removed hydro plat, since it requires rivers, which we do not yet have
gameInfo.civilizations.flatMap { it.cities }.map { it.cityConstructions }
.forEach{if("Hydro Plant" in it.builtBuildings) it.builtBuildings.remove("Hydro Plant")}
this.gameInfo = gameInfo this.gameInfo = gameInfo
if(settings.tutorialsShown.isEmpty() && this.gameInfo.tutorial.isNotEmpty()) if(settings.tutorialsShown.isEmpty() && this.gameInfo.tutorial.isNotEmpty())
settings.tutorialsShown.addAll(this.gameInfo.tutorial) settings.tutorialsShown.addAll(this.gameInfo.tutorial)

View File

@ -95,8 +95,19 @@ class GameInfo {
} }
for (civInfo in civilizations) for (civInfo in civilizations)
for (cityInfo in civInfo.cities) for (cityInfo in civInfo.cities) {
val cityConstructions = cityInfo.cityConstructions
// As of 2.9.6, removed hydro plant, since it requires rivers, which we do not yet have
if("Hydro Plant" in cityConstructions.builtBuildings)
cityConstructions.builtBuildings.remove("Hydro Plant")
if(cityConstructions.currentConstruction=="Hydro Plant") {
cityConstructions.currentConstruction=""
cityConstructions.chooseNextConstruction()
}
cityInfo.cityStats.update() cityInfo.cityStats.update()
}
} }
} }

View File

@ -154,6 +154,7 @@ class CityInfo {
expansion.setTransients() expansion.setTransients()
cityStats.cityInfo = this cityStats.cityInfo = this
cityConstructions.cityInfo = this cityConstructions.cityInfo = this
} }
fun endTurn() { fun endTurn() {