diff --git a/core/src/com/unciv/logic/civilization/managers/QuestManager.kt b/core/src/com/unciv/logic/civilization/managers/QuestManager.kt index f640accedc..3ff3eeca08 100644 --- a/core/src/com/unciv/logic/civilization/managers/QuestManager.kt +++ b/core/src/com/unciv/logic/civilization/managers/QuestManager.kt @@ -770,7 +770,7 @@ class QuestManager : IsPartOfGameInfoSerialization { val resourcesOnMap = civ.gameInfo.tileMap.values.asSequence().mapNotNull { it.resource }.distinct() val viewableResourcesForChallenger = resourcesOnMap.map { ruleset.tileResources[it]!! } - .filter { it.revealedBy == null || challenger.tech.isResearched(it.revealedBy!!) } + .filter { challenger.tech.isRevealed(it) } val notOwnedResources = viewableResourcesForChallenger.filter { it.resourceType != ResourceType.Bonus && diff --git a/core/src/com/unciv/logic/map/tile/Tile.kt b/core/src/com/unciv/logic/map/tile/Tile.kt index 62c38fbd00..d600ece540 100644 --- a/core/src/com/unciv/logic/map/tile/Tile.kt +++ b/core/src/com/unciv/logic/map/tile/Tile.kt @@ -531,13 +531,12 @@ class Tile : IsPartOfGameInfoSerialization, Json.Serializable { fun isCoastalTile() = _isCoastalTile fun hasViewableResource(civInfo: Civilization): Boolean = - resource != null && (tileResource.revealedBy == null || civInfo.tech.isResearched( - tileResource.revealedBy!!)) + resource != null && civInfo.tech.isRevealed(tileResource) fun getViewableTilesList(distance: Int): List = tileMap.getViewableTiles(position, distance) fun getTilesInDistance(distance: Int): Sequence = tileMap.getTilesInDistance(position, distance) fun getTilesInDistanceRange(range: IntRange): Sequence = tileMap.getTilesInDistanceRange(position, range) - fun getTilesAtDistance(distance: Int): Sequence =tileMap.getTilesAtDistance(position, distance) + fun getTilesAtDistance(distance: Int): Sequence = tileMap.getTilesAtDistance(position, distance) fun getDefensiveBonus(includeImprovementBonus: Boolean = true): Float { var bonus = baseTerrainObject.defenceBonus diff --git a/core/src/com/unciv/ui/screens/overviewscreen/ResourcesOverviewTab.kt b/core/src/com/unciv/ui/screens/overviewscreen/ResourcesOverviewTab.kt index 0cf7021872..a3e8dbea79 100644 --- a/core/src/com/unciv/ui/screens/overviewscreen/ResourcesOverviewTab.kt +++ b/core/src/com/unciv/ui/screens/overviewscreen/ResourcesOverviewTab.kt @@ -122,7 +122,7 @@ class ResourcesOverviewTab( TradeOffer("Trade offer","Trade offer", "Resources we're offering in trades") ; companion object { - fun safeValueOf(name: String) = values().firstOrNull { it.name == name } + fun safeValueOf(name: String) = entries.firstOrNull { it.name == name } } } private val fixedContent = Table() @@ -284,7 +284,7 @@ class ResourcesOverviewTab( /** Show unlocked **strategic** resources even if you have no access at all */ for (resource in viewingPlayer.gameInfo.ruleset.tileResources.values) { if (resource.resourceType != ResourceType.Strategic) continue - if (resource.revealedBy == null || viewingPlayer.tech.isResearched(resource.revealedBy!!)) + if (viewingPlayer.tech.isRevealed(resource)) newResourceSupplyList.add(resource, "No source", 0) } diff --git a/core/src/com/unciv/ui/screens/worldscreen/topbar/WorldScreenTopBarResources.kt b/core/src/com/unciv/ui/screens/worldscreen/topbar/WorldScreenTopBarResources.kt index 5d9d640384..aa36dd5d45 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/topbar/WorldScreenTopBarResources.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/topbar/WorldScreenTopBarResources.kt @@ -97,8 +97,7 @@ internal class WorldScreenTopBarResources(topbar: WorldScreenTopBar) : ScalingTa val amount = civResources[resource.name] ?: 0 - if (resource.revealedBy != null && !civInfo.tech.isResearched(resource.revealedBy!!) - && amount == 0) // You can trade for resources you cannot process yourself yet + if (!civInfo.tech.isRevealed(resource) && amount == 0) // You cannot trade for resources you cannot process yourself yet continue resourcesWrapper.add(icon).padLeft(if (index == 0) 0f else extraPadBetweenResources) diff --git a/desktop/src/com/unciv/app/desktop/ImagePacker.kt b/desktop/src/com/unciv/app/desktop/ImagePacker.kt index 7bc6a8a5a6..b56f0dc881 100644 --- a/desktop/src/com/unciv/app/desktop/ImagePacker.kt +++ b/desktop/src/com/unciv/app/desktop/ImagePacker.kt @@ -91,9 +91,9 @@ internal object ImagePacker { var innerException = ex while (innerException.cause != null && innerException.cause !== innerException) innerException = innerException.cause!! if (innerException === ex) - Log.error("Exception in ImagePacker: %s", ex.message) + Log.error("Exception in ImagePacker for mod ${mod.name}: ${ex.message}") else - Log.error("Exception in ImagePacker: %s (%s)", ex.message, innerException.message) + Log.error("Exception in ImagePacker for mod ${mod.name}: ${ex.message} (${innerException.message})") } } }