diff --git a/core/src/com/unciv/ui/images/Portrait.kt b/core/src/com/unciv/ui/images/Portrait.kt index bdc9dff407..6980bad505 100644 --- a/core/src/com/unciv/ui/images/Portrait.kt +++ b/core/src/com/unciv/ui/images/Portrait.kt @@ -171,6 +171,12 @@ class PortraitBuilding(name: String, size: Float) : Portrait(Type.Building, name } } +class PortraitUnavailableWonderForTechTree(name: String, size: Float) : Portrait(Type.Building, name, size) { + override fun getDefaultOuterBackgroundTint(): Color { + return Color.RED + } +} + class PortraitUnique(name: String, size: Float) : Portrait(Type.Unique, name, size) { override fun getDefaultImageTint(): Color { return Color.BLACK diff --git a/core/src/com/unciv/ui/objectdescriptions/TechnologyDescriptions.kt b/core/src/com/unciv/ui/objectdescriptions/TechnologyDescriptions.kt index f99e8b78ce..e460d10319 100644 --- a/core/src/com/unciv/ui/objectdescriptions/TechnologyDescriptions.kt +++ b/core/src/com/unciv/ui/objectdescriptions/TechnologyDescriptions.kt @@ -15,6 +15,7 @@ import com.unciv.models.translations.tr import com.unciv.ui.components.Fonts import com.unciv.ui.components.extensions.center import com.unciv.ui.images.ImageGetter +import com.unciv.ui.images.PortraitUnavailableWonderForTechTree import com.unciv.ui.screens.civilopediascreen.FormattedLine import com.unciv.ui.screens.civilopediascreen.ICivilopediaText import com.unciv.ui.screens.pickerscreens.TechButton @@ -91,7 +92,24 @@ object TechnologyDescriptions { } for (building in getEnabledBuildings(techName, ruleset, viewingCiv)) { - yield(ImageGetter.getConstructionPortrait(building.name, techIconSize)) + // We don't need to show the unavailable marker for techs that are already researched + // since this is mostly a feature to choose which technologies to research. + if (building.isWonder && !viewingCiv.tech.isResearched(techName)) { + val isAlreadyBuilt = viewingCiv.gameInfo.getCities() + // This is theoretically not necessary since we already checked the viewingCiv + // doesn't have the tech, so it can't have this built anyways. It should be a + // little more performant though to add this filter. + .filter{ it.civ != viewingCiv } + .any { it.cityConstructions.builtBuildings.contains(building.name) } + val wonderConstructionPortrait = + if (isAlreadyBuilt) + PortraitUnavailableWonderForTechTree(building.name, techIconSize) + else + ImageGetter.getConstructionPortrait(building.name, techIconSize) + yield(wonderConstructionPortrait) + } else { + yield(ImageGetter.getConstructionPortrait(building.name, techIconSize)) + } } yieldAll(