mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-14 12:00:12 +07:00
Resolved #3254 - food-to-production not added twice when calculating turns to production
This commit is contained in:
parent
fa41076cf2
commit
9a887e4840
@ -216,8 +216,7 @@ class CityConstructions {
|
||||
cityInfo.cityStats.update()
|
||||
}
|
||||
|
||||
var production = cityStatsForConstruction.production.roundToInt()
|
||||
if (constructionName == Constants.settler) production += cityStatsForConstruction.food.toInt()
|
||||
val production = cityStatsForConstruction.production.roundToInt()
|
||||
|
||||
return ceil(workLeft / production.toDouble()).toInt()
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ class CityStats {
|
||||
cityInfo.civInfo.updateStatsForNextTurn()
|
||||
}
|
||||
|
||||
private fun updateFinalStatList(){
|
||||
private fun updateFinalStatList() {
|
||||
val newFinalStatList = LinkedHashMap<String, Stats>() // again, we don't edit the existing currentCityStats directly, in order to avoid concurrency exceptions
|
||||
|
||||
for (entry in baseStatList)
|
||||
@ -507,7 +507,7 @@ class CityStats {
|
||||
totalFood = newFinalStatList.values.map { it.food }.sum() // recalculate because of previous change
|
||||
|
||||
// Since growth bonuses are special, (applied afterwards) they will be displayed separately in the user interface as well.
|
||||
if(totalFood>0) {
|
||||
if (totalFood > 0) {
|
||||
val foodFromGrowthBonuses = getGrowthBonusFromPoliciesAndWonders() * totalFood
|
||||
newFinalStatList["Policies"]!!.food += foodFromGrowthBonuses
|
||||
totalFood = newFinalStatList.values.map { it.food }.sum() // recalculate again
|
||||
|
@ -259,6 +259,8 @@ object RulesetCache :HashMap<String,Ruleset>() {
|
||||
println("${unit.name} requires resource ${unit.requiredResource} which does not exist!")
|
||||
if (unit.upgradesTo != null && !modRuleset.units.containsKey(unit.upgradesTo!!))
|
||||
println("${unit.name} upgrades to unit ${unit.upgradesTo} which does not exist!")
|
||||
if (unit.upgradesTo == unit.name)
|
||||
println("${unit.name} upgrades to itself!")
|
||||
if (unit.replaces != null && !modRuleset.units.containsKey(unit.replaces!!))
|
||||
println("${unit.replaces} replaces ${unit.replaces} which does not exist!")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user