From 303e0493d8829651a462e9de24077563fe96f90f Mon Sep 17 00:00:00 2001 From: r3versi Date: Mon, 23 Dec 2019 21:14:02 +0100 Subject: [PATCH] Fix Natural Wonders tile worked happiness not computed & double bonus from discovering extended (like GBR) Natural Wonder in same turn (#1518) --- core/src/com/unciv/logic/city/CityStats.kt | 6 +++++- .../com/unciv/logic/civilization/CivInfoTransientUpdater.kt | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/logic/city/CityStats.kt b/core/src/com/unciv/logic/city/CityStats.kt index bc212be1a3..cad1057013 100644 --- a/core/src/com/unciv/logic/city/CityStats.kt +++ b/core/src/com/unciv/logic/city/CityStats.kt @@ -222,6 +222,9 @@ class CityStats { if (civInfo.containsBuildingUnique("+1 happiness in each city")) 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 // to concurrency problems if we iterate on it while changing happinessList = newHappinessList @@ -390,8 +393,9 @@ class CityStats { } fun update() { - updateCityHappiness() + // We need to compute Tile yields before happiness updateBaseStatList() + updateCityHappiness() updateStatPercentBonusList() updateFinalStatList() // again, we don't edit the existing currentCityStats directly, in order to avoid concurrency exceptions diff --git a/core/src/com/unciv/logic/civilization/CivInfoTransientUpdater.kt b/core/src/com/unciv/logic/civilization/CivInfoTransientUpdater.kt index 669414b3d5..cf36552b02 100644 --- a/core/src/com/unciv/logic/civilization/CivInfoTransientUpdater.kt +++ b/core/src/com/unciv/logic/civilization/CivInfoTransientUpdater.kt @@ -84,6 +84,9 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo){ } for (tile in newlyViewedNaturalWonders) { + // GBR could be discovered twice otherwise! + if (civInfo.naturalWonders.contains(tile.naturalWonder)) + continue civInfo.discoverNaturalWonder(tile.naturalWonder!!) civInfo.addNotification("We have discovered [" + tile.naturalWonder + "]!", tile.position, Color.GOLD)