When exiting city, the city's unit is not selected

This commit is contained in:
Yair Morgenstern 2018-12-10 16:26:38 +02:00
parent 7ee76771f5
commit 437c422817
4 changed files with 9 additions and 9 deletions

View file

@ -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

View file

@ -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

View file

@ -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)
}
}

View file

@ -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)