From 437c42281765fe4be4b1f66eb45f9fed25c43d2f Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 10 Dec 2018 16:26:38 +0200 Subject: [PATCH] When exiting city, the city's unit is not selected --- core/src/com/unciv/logic/automation/Automation.kt | 2 -- .../src/com/unciv/logic/automation/NextTurnAutomation.kt | 4 +++- core/src/com/unciv/logic/city/PopulationManager.kt | 3 +-- core/src/com/unciv/ui/cityscreen/CityScreen.kt | 9 +++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/src/com/unciv/logic/automation/Automation.kt b/core/src/com/unciv/logic/automation/Automation.kt index 1bc709a5..d4eebca7 100644 --- a/core/src/com/unciv/logic/automation/Automation.kt +++ b/core/src/com/unciv/logic/automation/Automation.kt @@ -4,12 +4,10 @@ import com.badlogic.gdx.graphics.Color import com.unciv.logic.battle.CityCombatant import com.unciv.logic.city.CityConstructions import com.unciv.logic.city.CityInfo -import com.unciv.logic.city.CityStats import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.map.TileInfo import com.unciv.models.gamebasics.unit.BaseUnit import com.unciv.models.gamebasics.unit.UnitType -import com.unciv.models.stats.Stat import com.unciv.models.stats.Stats import com.unciv.ui.utils.getRandom import kotlin.math.max diff --git a/core/src/com/unciv/logic/automation/NextTurnAutomation.kt b/core/src/com/unciv/logic/automation/NextTurnAutomation.kt index 3c906671..d1b7280e 100644 --- a/core/src/com/unciv/logic/automation/NextTurnAutomation.kt +++ b/core/src/com/unciv/logic/automation/NextTurnAutomation.kt @@ -118,7 +118,9 @@ class NextTurnAutomation{ for (city in civInfo.cities) { city.workedTiles.clear() city.population.specialists.clear() - (0..city.population.population).forEach { city.population.autoAssignPopulation() } + for (i in 0..city.population.population) + city.population.autoAssignPopulation() + Automation().chooseNextConstruction(city.cityConstructions) if (city.health < city.getMaxHealth()) Automation().trainCombatUnit(city) // override previous decision if city is under attack diff --git a/core/src/com/unciv/logic/city/PopulationManager.kt b/core/src/com/unciv/logic/city/PopulationManager.kt index 5adbafd7..4c5f5430 100644 --- a/core/src/com/unciv/logic/city/PopulationManager.kt +++ b/core/src/com/unciv/logic/city/PopulationManager.kt @@ -5,7 +5,6 @@ import com.unciv.logic.automation.Automation import com.unciv.logic.map.TileInfo import com.unciv.models.stats.Stat import com.unciv.models.stats.Stats -import com.unciv.ui.utils.getRandom import kotlin.math.roundToInt class PopulationManager { @@ -134,7 +133,7 @@ class PopulationManager { || worstJob == null) { cityInfo.workedTiles.remove(worstWorkedTile!!.position) } else { - specialists.add(worstJob!!, -1f) + specialists.add(worstJob, -1f) } } diff --git a/core/src/com/unciv/ui/cityscreen/CityScreen.kt b/core/src/com/unciv/ui/cityscreen/CityScreen.kt index 7c60f66e..c0fe6ac3 100644 --- a/core/src/com/unciv/ui/cityscreen/CityScreen.kt +++ b/core/src/com/unciv/ui/cityscreen/CityScreen.kt @@ -137,10 +137,11 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() { private fun updateGoToWorldButton() { goToWorldButton.clearListeners() goToWorldButton.onClick { - game.setWorldScreen() - game.worldScreen.tileMapHolder.setCenterPosition(city.location) - dispose() - } + game.setWorldScreen() + game.worldScreen.tileMapHolder.setCenterPosition(city.location) + game.worldScreen.bottomBar.unitTable.selectedUnit=null + dispose() + } goToWorldButton.pad(5f) goToWorldButton.setSize(goToWorldButton.prefWidth, goToWorldButton.prefHeight)