diff --git a/core/src/com/unciv/logic/civilization/managers/TechManager.kt b/core/src/com/unciv/logic/civilization/managers/TechManager.kt index b6bcef9b04..cca3e2f19e 100644 --- a/core/src/com/unciv/logic/civilization/managers/TechManager.kt +++ b/core/src/com/unciv/logic/civilization/managers/TechManager.kt @@ -312,11 +312,22 @@ class TechManager : IsPartOfGameInfoSerialization { if (isNewTech) civInfo.popupAlerts.add(PopupAlert(AlertType.TechResearched, techName)) + val revealedResources = getRuleset().tileResources.values.filter { techName == it.revealedBy } + var mayNeedUpdateResources = revealedResources.isNotEmpty() // default for AI if (civInfo.playerType == PlayerType.Human) { - for (revealedResource in getRuleset().tileResources.values.filter { techName == it.revealedBy }) { - civInfo.gameInfo.notifyExploredResources(civInfo, revealedResource.name, 5, false) + mayNeedUpdateResources = false + for (revealedResource in revealedResources) { + // notifyExploredResources scans the player's owned tiles and returns false if none + // found with a revealed resource - keep this knowledge to avoid the update call. + mayNeedUpdateResources = mayNeedUpdateResources || + civInfo.gameInfo.notifyExploredResources(civInfo, revealedResource.name, 5, false) } } + // At least in the case of a human player hurrying research, this civ's resource availability + // may now be out of date - e.g. when an owned tile by luck already has an appropriate improvement. + // That can be seen on WorldScreenTopBar, so better update unless we know there's no resource change. + if (mayNeedUpdateResources) + civInfo.cache.updateCivResources() obsoleteOldUnits(techName)