Merge pull request #421 from ninjatao/city_screen_info

Fix city screen population info.
This commit is contained in:
Yair Morgenstern 2019-01-20 16:27:04 +02:00 committed by GitHub
commit f765566cbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,11 +104,19 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() {
" (" + city.expansion.cultureStored + "/" + city.expansion.getCultureToNextTile() + ")"
table.add(Label(turnsToExpansionString,skin)).colspan(columns).row()
val turnsToPopulation = ceil((city.population.getFoodToNextPopulation()-city.population.foodStored)
/ city.cityStats.currentCityStats.food).toInt()
val turnsToPopString = turnsToPopulation.toString()+ " turns to new population" +
" (" + city.population.foodStored + "/" + city.population.getFoodToNextPopulation() + ")"
table.add(Label(turnsToPopString,skin)).colspan(columns).row()
val turnsToPopString : String
if (city.cityStats.currentCityStats.food > 0) {
val turnsToPopulation = ceil((city.population.getFoodToNextPopulation()-city.population.foodStored)
/ city.cityStats.currentCityStats.food).toInt()
turnsToPopString = turnsToPopulation.toString()+ " turns to new population"
} else if (city.cityStats.currentCityStats.food < 0) {
val turnsToStarvation = ceil(city.population.foodStored / -city.cityStats.currentCityStats.food).toInt()
turnsToPopString = turnsToStarvation.toString()+ " turns to lose population"
} else {
turnsToPopString = "Stopped population growth"
}
table.add(Label(turnsToPopString + " (" + city.population.foodStored + "/" + city.population.getFoodToNextPopulation() + ")"
,skin)).colspan(columns).row()
if (city.resistanceCounter > 0) {
table.add(Label("In resistance for another ${city.resistanceCounter} turns",skin)).row()