Fix Natural Wonders tile worked happiness not computed & double bonus from discovering extended (like GBR) Natural Wonder in same turn (#1518)

This commit is contained in:
r3versi 2019-12-23 21:14:02 +01:00 committed by Yair Morgenstern
parent 13d11f02ca
commit 303e0493d8
2 changed files with 8 additions and 1 deletions

View file

@ -222,6 +222,9 @@ class CityStats {
if (civInfo.containsBuildingUnique("+1 happiness in each city")) if (civInfo.containsBuildingUnique("+1 happiness in each city"))
newHappinessList["Wonders"] = 1f newHappinessList["Wonders"] = 1f
if (baseStatList.containsKey("Tile yields"))
newHappinessList["Tile yields"] = baseStatList["Tile yields"]!!.happiness
// we don't want to modify the existing happiness list because that leads // we don't want to modify the existing happiness list because that leads
// to concurrency problems if we iterate on it while changing // to concurrency problems if we iterate on it while changing
happinessList = newHappinessList happinessList = newHappinessList
@ -390,8 +393,9 @@ class CityStats {
} }
fun update() { fun update() {
updateCityHappiness() // We need to compute Tile yields before happiness
updateBaseStatList() updateBaseStatList()
updateCityHappiness()
updateStatPercentBonusList() updateStatPercentBonusList()
updateFinalStatList() // again, we don't edit the existing currentCityStats directly, in order to avoid concurrency exceptions updateFinalStatList() // again, we don't edit the existing currentCityStats directly, in order to avoid concurrency exceptions

View file

@ -84,6 +84,9 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo){
} }
for (tile in newlyViewedNaturalWonders) { for (tile in newlyViewedNaturalWonders) {
// GBR could be discovered twice otherwise!
if (civInfo.naturalWonders.contains(tile.naturalWonder))
continue
civInfo.discoverNaturalWonder(tile.naturalWonder!!) civInfo.discoverNaturalWonder(tile.naturalWonder!!)
civInfo.addNotification("We have discovered [" + tile.naturalWonder + "]!", tile.position, Color.GOLD) civInfo.addNotification("We have discovered [" + tile.naturalWonder + "]!", tile.position, Color.GOLD)