mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-02 12:24:15 +07:00
Fixed a bug where "[+amount] population [in this city]" did not work (#5476)
This commit is contained in:
parent
ff67e66348
commit
67650fec00
@ -114,6 +114,7 @@ object UniqueTriggerActivation {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
OneTimeFreeGreatPerson, MayanGainGreatPerson -> {
|
||||
if (civInfo.isSpectator()) return false
|
||||
val greatPeople = civInfo.getGreatPeople()
|
||||
@ -155,18 +156,21 @@ object UniqueTriggerActivation {
|
||||
return civInfo.addUnit(greatPerson.name, chosenCity) != null
|
||||
}
|
||||
}
|
||||
|
||||
OneTimeGainPopulation -> {
|
||||
val citiesWithPopulationChanged: MutableList<Vector2> = mutableListOf()
|
||||
for (city in civInfo.cities) {
|
||||
if (city.matchesFilter(unique.params[1])) {
|
||||
city.population.addPopulation(unique.params[0].toInt())
|
||||
citiesWithPopulationChanged.add(city.location)
|
||||
}
|
||||
val applicableCities = when (unique.params[1]) {
|
||||
"in this city" -> listOf(cityInfo!!)
|
||||
"in other cities" -> civInfo.cities.filter { it != cityInfo }
|
||||
else -> civInfo.cities.filter { it.matchesFilter(unique.params[1]) }
|
||||
}
|
||||
if (notification != null && citiesWithPopulationChanged.isNotEmpty())
|
||||
for (city in applicableCities) {
|
||||
city.population.addPopulation(unique.params[0].toInt())
|
||||
}
|
||||
if (notification != null && applicableCities.isNotEmpty())
|
||||
civInfo.addNotification(
|
||||
notification,
|
||||
LocationAction(citiesWithPopulationChanged),
|
||||
LocationAction(applicableCities.map { it.location }),
|
||||
NotificationIcon.Population
|
||||
)
|
||||
return citiesWithPopulationChanged.isNotEmpty()
|
||||
|
Loading…
Reference in New Issue
Block a user