From bc1405cdb30707054294cffcb42b64f76adea647 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 1 Jun 2021 19:56:54 +0300 Subject: [PATCH] City construction queue: Subsequent units no longer displays construction progress towards first unit of its kind --- core/src/com/unciv/logic/city/CityConstructions.kt | 2 +- core/src/com/unciv/models/ruleset/Ruleset.kt | 2 +- core/src/com/unciv/ui/cityscreen/CityConstructionsTable.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/logic/city/CityConstructions.kt b/core/src/com/unciv/logic/city/CityConstructions.kt index fbfc3ab376..840f53f71c 100644 --- a/core/src/com/unciv/logic/city/CityConstructions.kt +++ b/core/src/com/unciv/logic/city/CityConstructions.kt @@ -123,7 +123,7 @@ class CityConstructions { val construction = getConstruction(constructionName) val cost = construction.getProductionCost(cityInfo.civInfo) val turnsToConstruction = turnsToConstruction(constructionName, useStoredProduction) - val currentProgress = getWorkDone(constructionName) + val currentProgress = if (useStoredProduction) getWorkDone(constructionName) else 0 if (currentProgress == 0) return "\n$cost${Fonts.production} $turnsToConstruction${Fonts.turn}" else return "\n$currentProgress/$cost${Fonts.production}\n$turnsToConstruction${Fonts.turn}" } diff --git a/core/src/com/unciv/models/ruleset/Ruleset.kt b/core/src/com/unciv/models/ruleset/Ruleset.kt index b2ee69979a..491a7a2ccb 100644 --- a/core/src/com/unciv/models/ruleset/Ruleset.kt +++ b/core/src/com/unciv/models/ruleset/Ruleset.kt @@ -323,7 +323,7 @@ class Ruleset { fun getPrereqTree(technologyName: String): Sequence { val technology = technologies[technologyName] if (technology == null) return sequenceOf() - return technology.prerequisites.asSequence() + technology.prerequisites.flatMap { getPrereqTree(it) } + return technology.prerequisites.asSequence() + technology.prerequisites.asSequence().flatMap { getPrereqTree(it) } } val allOtherPrereqs = tech.prerequisites.asSequence().filterNot { it == prereq }.flatMap { getPrereqTree(it) } diff --git a/core/src/com/unciv/ui/cityscreen/CityConstructionsTable.kt b/core/src/com/unciv/ui/cityscreen/CityConstructionsTable.kt index 08b8d26273..d1f1d4e236 100644 --- a/core/src/com/unciv/ui/cityscreen/CityConstructionsTable.kt +++ b/core/src/com/unciv/ui/cityscreen/CityConstructionsTable.kt @@ -220,7 +220,7 @@ class CityConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBase var text = constructionName.tr() + if (constructionName in PerpetualConstruction.perpetualConstructionsMap) "\n∞" - else cityConstructions.getTurnsToConstructionString(constructionName) + else cityConstructions.getTurnsToConstructionString(constructionName, isFirstConstructionOfItsKind) val constructionResource = cityConstructions.getConstruction(constructionName).getResourceRequirements() for ((resource, amount) in constructionResource)