mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04:00
Fixed crash when a city had negative population due to faster razing (#4389)
This commit is contained in:
parent
7875ec4896
commit
9e37cc8f16
@ -409,7 +409,7 @@ class CityInfo {
|
||||
cityConstructions.endTurn(stats)
|
||||
expansion.nextTurn(stats.culture)
|
||||
if (isBeingRazed) {
|
||||
val removedPopulation = 1 + civInfo.getMatchingUniques("Cities are razed [] times as fast").sumBy { it.params[0].toInt() }
|
||||
val removedPopulation = 1 + civInfo.getMatchingUniques("Cities are razed [] times as fast").sumBy { it.params[0].toInt() - 1 }
|
||||
population.addPopulation(-1 * removedPopulation)
|
||||
if (population.population <= 0) {
|
||||
civInfo.addNotification("[$name] has been razed to the ground!", location, "OtherIcons/Fire")
|
||||
|
@ -73,6 +73,7 @@ class PopulationManager {
|
||||
|
||||
internal fun addPopulation(count: Int) {
|
||||
population += count
|
||||
if (population < 0) population = 0
|
||||
val freePopulation = getFreePopulation()
|
||||
if (freePopulation < 0) {
|
||||
unassignExtraPopulation()
|
||||
|
Loading…
x
Reference in New Issue
Block a user