mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-24 18:06:04 +07:00
Fixed a bug where the growth bar's height exceeded the group. (#1646)
This happened on the turn that a city was taken.
This commit is contained in:
parent
fe837d78ee
commit
b1b82c6a67
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user