Bugfix - cities with maintenance but no gold production now display gold breakdown

This commit is contained in:
Yair Morgenstern 2019-06-25 23:14:13 +03:00
parent 921dd28296
commit 46bd65e45a

View file

@ -139,6 +139,14 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS
unifiedStatList[entry.key]!!.happiness=entry.value
}
// Add maintenance if relevant
val maintenance = cityStats.cityInfo.cityConstructions.getMaintenanceCosts()
if(maintenance>0)
unifiedStatList["Maintenance"]=Stats().add(Stat.Gold,-maintenance.toFloat())
for(stat in Stat.values()){
if(unifiedStatList.all { it.value.get(stat)==0f }) continue
@ -157,13 +165,6 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS
val decimal = DecimalFormat("0.#").format(specificStatValue)
statValuesTable.add("+$decimal%".toLabel()).row()
}
if(stat==Stat.Gold){
val maintenance = cityStats.cityInfo.cityConstructions.getMaintenanceCosts()
if(maintenance>0){
statValuesTable.add("Maintenance".toLabel())
statValuesTable.add("-$maintenance".toLabel())
}
}
if(stat==Stat.Food){
statValuesTable.add("Food eaten".toLabel())
statValuesTable.add(("-"+DecimalFormat("0.#").format(cityStats.foodEaten)).toLabel()).row()