diff --git a/core/src/com/unciv/logic/city/CityConstructions.kt b/core/src/com/unciv/logic/city/CityConstructions.kt index 135b9aff97..ecd152f0ab 100644 --- a/core/src/com/unciv/logic/city/CityConstructions.kt +++ b/core/src/com/unciv/logic/city/CityConstructions.kt @@ -201,11 +201,14 @@ class CityConstructions { val cityStatsForConstruction: Stats if (currentConstructionFromQueue == constructionName) cityStatsForConstruction = cityInfo.cityStats.currentCityStats else { - // The ol' Switcharoo - what would our stats be if that was our current construction? - // Since this is only ever used for UI purposes, I feel fine with having it be a bit inefficient - // and recalculating the entire city stats - // We don't want to change our current construction queue - what if we have an empty queue, too many changes to check for - - // So we must clone it and see what would happen if that was our construction + /* + The ol' Switcharoo - what would our stats be if that was our current construction? + Since this is only ever used for UI purposes, I feel fine with having it be a bit inefficient + and recalculating the entire city stats + We don't want to change our current construction queue - what if we have an empty queue, + this can affect the city if we run it on another thread like in ConstructionsTable - + So we run the numbers for the other construction + */ val construction = cityInfo.cityConstructions.getConstruction(constructionName) cityInfo.cityStats.update(construction) diff --git a/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt b/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt index 81b437abde..ec79ef5fe7 100644 --- a/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt +++ b/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt @@ -167,9 +167,9 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre thread { + val constructionButtonDTOList = getConstructionButtonDTOs() // Since this can be a heavy operation and leads to many ANRs on older phones... Gdx.app.postRunnable { // For some bizarre reason, moving this to another thread messes up the entire construction list?! Haven't figured out why yet - val constructionButtonDTOList = getConstructionButtonDTOs() // Since this can be a heavy operation and leads to many ANRs on older phones... availableConstructionsTable.clear() for (dto in constructionButtonDTOList) {