From b1b82c6a67bd8fa475e62555af0d1c595d67d7bc Mon Sep 17 00:00:00 2001 From: drwhut Date: Thu, 9 Jan 2020 18:18:37 +0000 Subject: [PATCH] Fixed a bug where the growth bar's height exceeded the group. (#1646) This happened on the turn that a city was taken. --- core/src/com/unciv/ui/tilegroups/CityButton.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/src/com/unciv/ui/tilegroups/CityButton.kt b/core/src/com/unciv/ui/tilegroups/CityButton.kt index 9045d88559..b97f31b8e1 100644 --- a/core/src/com/unciv/ui/tilegroups/CityButton.kt +++ b/core/src/com/unciv/ui/tilegroups/CityButton.kt @@ -178,6 +178,10 @@ class CityButton(val city: CityInfo, internal val tileGroup: WorldTileGroup, ski var growthPercentage = city.population.foodStored / city.population.getFoodToNextPopulation().toFloat() if (growthPercentage < 0) growthPercentage = 0.0f + // This can happen if the city was just taken, and there was excess food stored. + // Without it, it caused the growth bar's height to exceed that of the group's. + if (growthPercentage > 1) growthPercentage = 1.0f + val growthBar = ImageGetter.getProgressBarVertical(2f, groupHeight, if (city.isStarving()) 1.0f else growthPercentage, if (city.isStarving()) Color.RED else growthGreen, Color.BLACK)