Duantao/settler food info (#1198)

* Better info for building settler.

* Shorter message.

* Fix message.
This commit is contained in:
Duan Tao 2019-10-16 23:16:27 +08:00 committed by Yair Morgenstern
parent 00d0f27871
commit 691a305e50
2 changed files with 13 additions and 4 deletions

View file

@ -950,6 +950,10 @@
Japanese:"[turnsToPopulation]新しい人口に目を向けます"
}
"Food converts to production":{
}
"[turnsToStarvation] turns to lose population":{
Italian:"Perdita di popolazione tra [turnsToStarvation] turni"
Russian:"[turnsToStarvation] ходов до уменьшения населения"

View file

@ -6,6 +6,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
import com.badlogic.gdx.utils.Align
import com.unciv.Constants
import com.unciv.UnCivGame
import com.unciv.logic.HexMath
import com.unciv.logic.city.CityInfo
@ -132,10 +133,14 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() {
val turnsToPopString : String
if (city.cityStats.currentCityStats.food > 0) {
var turnsToPopulation = ceil((city.population.getFoodToNextPopulation()-city.population.foodStored)
/ city.cityStats.currentCityStats.food).toInt()
if (turnsToPopulation < 1) turnsToPopulation = 1
turnsToPopString = "[$turnsToPopulation] turns to new population".tr()
if (city.cityConstructions.currentConstruction == Constants.settler) {
turnsToPopString = "Food converts to production".tr()
} else {
var turnsToPopulation = ceil((city.population.getFoodToNextPopulation()-city.population.foodStored)
/ city.cityStats.currentCityStats.food).toInt()
if (turnsToPopulation < 1) turnsToPopulation = 1
turnsToPopString = "[$turnsToPopulation] turns to new population".tr()
}
} else if (city.cityStats.currentCityStats.food < 0) {
val turnsToStarvation = floor(city.population.foodStored / -city.cityStats.currentCityStats.food).toInt() + 1
turnsToPopString = "[$turnsToStarvation] turns to lose population".tr()