diff --git a/android/assets/jsons/Translations/Diplomacy,Trade,Nations.json b/android/assets/jsons/Translations/Diplomacy,Trade,Nations.json index b77eae7cc0..f8c6da8c29 100644 --- a/android/assets/jsons/Translations/Diplomacy,Trade,Nations.json +++ b/android/assets/jsons/Translations/Diplomacy,Trade,Nations.json @@ -846,7 +846,7 @@ } "Augustus Caesar":{ - Italian:"Cesare Augusto"Harun al-Rashid + Italian:"Cesare Augusto" } "+25% Production towards any buildings that already exist in the Capital":{ diff --git a/core/src/com/unciv/GameSettings.kt b/core/src/com/unciv/GameSettings.kt index 5e2305751f..53339c1942 100644 --- a/core/src/com/unciv/GameSettings.kt +++ b/core/src/com/unciv/GameSettings.kt @@ -15,6 +15,7 @@ class GameSettings { var turnsBetweenAutosaves = 1 var tileSet:String = "FantasyHex" var showTutorials: Boolean = true + var autoAssignCityProduction: Boolean = true fun save(){ GameSaver().setGeneralSettings(this) diff --git a/core/src/com/unciv/logic/automation/Automation.kt b/core/src/com/unciv/logic/automation/Automation.kt index 0f7c4f6956..7cbc12827d 100644 --- a/core/src/com/unciv/logic/automation/Automation.kt +++ b/core/src/com/unciv/logic/automation/Automation.kt @@ -2,6 +2,7 @@ package com.unciv.logic.automation import com.badlogic.gdx.graphics.Color import com.unciv.Constants +import com.unciv.UnCivGame import com.unciv.logic.battle.CityCombatant import com.unciv.logic.city.CityConstructions import com.unciv.logic.city.CityInfo @@ -85,6 +86,7 @@ class Automation { fun chooseNextConstruction(cityConstructions: CityConstructions) { cityConstructions.run { + if(!UnCivGame.Current.settings.autoAssignCityProduction) return if (getCurrentConstruction() !is SpecialConstruction) return // don't want to be stuck on these forever val buildableNotWonders = getBuildableBuildings().filterNot { it.isWonder || it.isNationalWonder } diff --git a/core/src/com/unciv/logic/city/CityConstructions.kt b/core/src/com/unciv/logic/city/CityConstructions.kt index d2e949c68b..ea21a41d75 100644 --- a/core/src/com/unciv/logic/city/CityConstructions.kt +++ b/core/src/com/unciv/logic/city/CityConstructions.kt @@ -57,7 +57,8 @@ class CityConstructions { fun getCityProductionTextForCityButton(): String { val currentConstructionSnapshot = currentConstruction // See below var result = currentConstructionSnapshot .tr() - if (SpecialConstruction.getSpecialConstructions().none { it.name==currentConstructionSnapshot }) + if (currentConstructionSnapshot!="" + && SpecialConstruction.getSpecialConstructions().none { it.name==currentConstructionSnapshot }) result += "\r\n" + turnsToConstruction(currentConstructionSnapshot ) + " {turns}".tr() return result } @@ -65,7 +66,8 @@ class CityConstructions { fun getProductionForTileInfo(): String { val currentConstructionSnapshot = currentConstruction // this is because there were rare errors tht I assume were caused because currentContruction changed on another thread var result = currentConstructionSnapshot.tr() - if (SpecialConstruction.getSpecialConstructions().none { it.name==currentConstructionSnapshot }) + if (currentConstructionSnapshot!="" + && SpecialConstruction.getSpecialConstructions().none { it.name==currentConstructionSnapshot }) result += "\r\n{in} ".tr() + turnsToConstruction(currentConstructionSnapshot) + " {turns}".tr() return result } diff --git a/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt b/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt index aae1728466..88d1a4f94b 100644 --- a/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt +++ b/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt @@ -20,6 +20,19 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre var constructionScrollPane:ScrollPane?=null var lastConstruction = "" + + fun update() { + val city = cityScreen.city + pad(10f) + columnDefaults(0).padRight(10f) + clear() + + addConstructionPickerScrollpane(city) + addCurrentConstructionTable(city) + + pack() + } + private fun getProductionButton(construction: String, buttonText: String, rejectionReason: String=""): Table { val pickProductionButton = Table() pickProductionButton.touchable = Touchable.enabled @@ -54,18 +67,6 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre return pickProductionButton } - fun update() { - val city = cityScreen.city - pad(10f) - columnDefaults(0).padRight(10f) - clear() - - addConstructionPickerScrollpane(city) - addCurrentConstructionTable(city) - - pack() - } - private fun Table.addCategory(title:String,list:ArrayList){ if(list.isEmpty()) return val titleTable = Table() @@ -169,26 +170,35 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre currentConstructionTable.background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK,0.5f)) currentConstructionTable.pad(10f) - currentConstructionTable.add( - ImageGetter.getConstructionImage(city.cityConstructions.currentConstruction).surroundWithCircle(50f)) - .pad(5f) + val userNeedsToSetProduction = city.cityConstructions.currentConstruction=="" + if(!userNeedsToSetProduction) { + currentConstructionTable.add( + ImageGetter.getConstructionImage(city.cityConstructions.currentConstruction).surroundWithCircle(50f)) + .pad(5f) - val buildingText = city.cityConstructions.getCityProductionTextForCityButton() - currentConstructionTable.add(buildingText.toLabel().setFontColor(Color.WHITE)).row() + val buildingText = city.cityConstructions.getCityProductionTextForCityButton() + currentConstructionTable.add(buildingText.toLabel().setFontColor(Color.WHITE)).row() + } + else{ + currentConstructionTable.add() // no icon + currentConstructionTable.add("Pick construction".toLabel()).row() + } - val currentConstruction = city.cityConstructions.getCurrentConstruction() val description: String - if (currentConstruction is BaseUnit) - description = currentConstruction.getDescription(true) - else if (currentConstruction is Building) - description = currentConstruction.getDescription(true, city.civInfo) - else description = currentConstruction.description.tr() + if(userNeedsToSetProduction) + description="" + else if (construction is BaseUnit) + description = construction.getDescription(true) + else if (construction is Building) + description = construction.getDescription(true, city.civInfo) + else description = construction.description.tr() val descriptionLabel = description.toLabel() descriptionLabel.setWrap(true) descriptionLabel.width = stage.width / 4 val descriptionScroll = ScrollPane(descriptionLabel) - currentConstructionTable.add(descriptionScroll).colspan(2).width(stage.width / 4).height(stage.height / 8) + currentConstructionTable.add(descriptionScroll).colspan(2) + .width(stage.width / 4).height(stage.height / 8) add(currentConstructionTable.addBorder(2f, Color.WHITE)) } diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index 4203f4f87a..35750aaab1 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -16,6 +16,7 @@ import com.unciv.models.gamebasics.tile.ResourceType import com.unciv.models.gamebasics.tr import com.unciv.models.gamebasics.unit.UnitType import com.unciv.ui.VictoryScreen +import com.unciv.ui.cityscreen.CityScreen import com.unciv.ui.pickerscreens.GreatPersonPickerScreen import com.unciv.ui.pickerscreens.PolicyPickerScreen import com.unciv.ui.pickerscreens.TechButton @@ -246,6 +247,13 @@ class WorldScreen : CameraStageBaseScreen() { return@onClick } + val cityWithNoProductionSet = currentPlayerCiv.cities + .firstOrNull{it.cityConstructions.currentConstruction==""} + if(cityWithNoProductionSet!=null){ + game.screen = CityScreen(cityWithNoProductionSet) + return@onClick + } + if (currentPlayerCiv.shouldOpenTechPicker()) { game.screen = TechPickerScreen(currentPlayerCiv.tech.freeTechs != 0, currentPlayerCiv) return@onClick @@ -297,6 +305,8 @@ class WorldScreen : CameraStageBaseScreen() { fun updateNextTurnButton() { val text = if (currentPlayerCiv.shouldGoToDueUnit()) "Next unit" + else if(currentPlayerCiv.cities.any{it.cityConstructions.currentConstruction==""}) + "Pick construction" else if(currentPlayerCiv.shouldOpenTechPicker()) "Pick a tech" else if(currentPlayerCiv.policies.shouldOpenPolicyPicker) diff --git a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt index 4b3d52fbc1..b01d0c43c7 100644 --- a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt +++ b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt @@ -68,6 +68,12 @@ class WorldScreenOptionsTable(screen:WorldScreen) : PopupTable(screen){ update() } + add("Auto-assign city production".toLabel()) + addButton(if(settings.autoAssignCityProduction) "Yes".tr() else "No".tr()) { + settings.autoAssignCityProduction= !settings.autoAssignCityProduction + update() + } + addLanguageSelectBox() addResolutionSelectBox()