From d3356c94fdc10b82878a461977c169a890e8ef07 Mon Sep 17 00:00:00 2001 From: itanasi <44038014+itanasi@users.noreply.github.com> Date: Mon, 19 Feb 2024 11:46:57 -0800 Subject: [PATCH] Minor style updates (#11154) * Properly Calculate Population based on Food Conversion to Prod Trigger properly when Queue is changed * Remove triggers * Missed a trigger * Add triggers in CityConstructionsTable so we can call cityScreen.update() * Properly Calculate Population based on Food Conversion to Prod Trigger properly when Queue is changed * Remove triggers * Missed a trigger * Add triggers in CityConstructionsTable so we can call cityScreen.update() * Minor style cleanups * Properly Calculate Population based on Food Conversion to Prod Trigger properly when Queue is changed * Remove triggers * Missed a trigger * Properly Calculate Population based on Food Conversion to Prod Trigger properly when Queue is changed * Remove triggers * Missed a trigger * Minor style cleanups --- core/src/com/unciv/logic/automation/Automation.kt | 2 +- core/src/com/unciv/logic/city/CityStats.kt | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/logic/automation/Automation.kt b/core/src/com/unciv/logic/automation/Automation.kt index 8684eac43e..dfeec1cc78 100644 --- a/core/src/com/unciv/logic/automation/Automation.kt +++ b/core/src/com/unciv/logic/automation/Automation.kt @@ -63,7 +63,7 @@ object Automation { val surplusFood = cityStats[Stat.Food] // If current Production converts Food into Production, then calculate increased Production Yield - if(cityStatsObj.canConvertFoodToProduction(surplusFood, city.cityConstructions.getCurrentConstruction())) { + if (cityStatsObj.canConvertFoodToProduction(surplusFood, city.cityConstructions.getCurrentConstruction())) { // calculate delta increase of food->prod. This isn't linear yieldStats.production += cityStatsObj.getProductionFromExcessiveFood(surplusFood+yieldStats.food) - cityStatsObj.getProductionFromExcessiveFood(surplusFood) yieldStats.food = 0f // all food goes to 0 diff --git a/core/src/com/unciv/logic/city/CityStats.kt b/core/src/com/unciv/logic/city/CityStats.kt index c45b82f5ab..8f27697f89 100644 --- a/core/src/com/unciv/logic/city/CityStats.kt +++ b/core/src/com/unciv/logic/city/CityStats.kt @@ -606,8 +606,13 @@ class CityStats(val city: City) { && currentConstruction.hasUnique(UniqueType.ConvertFoodToProductionWhenConstructed)) } - // calculate the conversion of the excessive food to the production - // See for details: https://civilization.fandom.com/wiki/Settler_(Civ5) + /** + * Calculate the conversion of the excessive food to production when + * [UniqueType.ConvertFoodToProductionWhenConstructed] is at front of the build queue + * @param food is amount of excess Food generates this turn + * See for details: https://civilization.fandom.com/wiki/Settler_(Civ5) + * @see calcFoodEaten as well for Food consumed this turn + */ fun getProductionFromExcessiveFood(food : Float): Float { return if (food >= 4.0f ) 2.0f + (food / 4.0f).toInt() else if (food >= 2.0f ) 2.0f