Fixed crash when diplomacy values change while ending the turn

This commit is contained in:
Yair Morgenstern
2020-03-03 21:45:39 +02:00
parent 163d4ad347
commit 86576e25ae
3 changed files with 22 additions and 20 deletions

View File

@ -457,7 +457,7 @@ class CivilizationInfo {
goldenAges.endTurn(getHappiness())
getCivUnits().forEach { it.endTurn() }
diplomacy.values.forEach { it.nextTurn() }
diplomacy.values.toList().forEach { it.nextTurn() } // we copy the diplomacy values so if it changes in-loop we won't crash
updateAllyCivForCityState()
updateHasActiveGreatWall()
}

View File

@ -27,7 +27,7 @@ class EmpireOverviewScreen(private val viewingPlayer:CivilizationInfo) : CameraS
onBackButtonClicked { UncivGame.Current.setWorldScreen() }
val closeButton = "×".toLabel(Color.BLACK, 30).apply { this.setAlignment(Align.center) }
.surroundWithCircle(30f).apply { circle.color=Color.RED }
.surroundWithCircle(50f).apply { circle.color = Color.RED.cpy().lerp(Color.BLACK, 0.1f) }
closeButton.onClick { UncivGame.Current.setWorldScreen() }
closeButton.y = stage.height - closeButton.height - 5
topTable.add(closeButton)

View File

@ -48,8 +48,9 @@ class SpecialistAllocationTable(val cityScreen: CityScreen): Table(CameraStageBa
private fun getAssignButton(assignedSpecialists: Int, maxSpecialists: Int, stat: Stat):Actor {
if (assignedSpecialists >= maxSpecialists || cityInfo.isPuppet) return Table()
val assignButton = "+".toLabel(Color.BLACK,24).apply { this.setAlignment(Align.center) }
.surroundWithCircle(30f).apply { circle.color= Color.GREEN }
val assignButton = "+".toLabel(Color.BLACK,24)
.apply { this.setAlignment(Align.center) }
.surroundWithCircle(30f).apply { circle.color= Color.GREEN.cpy().lerp(Color.BLACK,0.2f) }
assignButton.onClick {
cityInfo.population.specialists.add(stat, 1f)
cityInfo.cityStats.update()
@ -63,8 +64,9 @@ class SpecialistAllocationTable(val cityScreen: CityScreen): Table(CameraStageBa
private fun getUnassignButton(assignedSpecialists: Int, stat: Stat):Actor {
if (assignedSpecialists <= 0 || cityInfo.isPuppet) return Table()
val unassignButton = "-".toLabel(Color.BLACK,24).apply { this.setAlignment(Align.center) }
.surroundWithCircle(30f).apply { circle.color= Color.RED }
val unassignButton = "-".toLabel(Color.BLACK,24)
.apply { this.setAlignment(Align.center) }
.surroundWithCircle(30f).apply { circle.color= Color.RED.cpy().lerp(Color.BLACK,0.1f) }
unassignButton.onClick {
cityInfo.population.specialists.add(stat, -1f)
cityInfo.cityStats.update()