mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-15 02:09:21 +07:00
Prevent some state changing actions during next-turn (#9327)
* Prevent some state changing actions during next-turn * Direct canChangeState
This commit is contained in:
@ -263,7 +263,8 @@ class UnitOverviewTab(
|
|||||||
// Upgrade column
|
// Upgrade column
|
||||||
if (unit.upgrade.canUpgrade()) {
|
if (unit.upgrade.canUpgrade()) {
|
||||||
val unitAction = UnitActionsUpgrade.getUpgradeAction(unit)
|
val unitAction = UnitActionsUpgrade.getUpgradeAction(unit)
|
||||||
val enable = unitAction?.action != null && viewingPlayer.isCurrentPlayer()
|
val enable = unitAction?.action != null && viewingPlayer.isCurrentPlayer() &&
|
||||||
|
GUI.isAllowedChangeState()
|
||||||
val upgradeIcon = ImageGetter.getUnitIcon(unit.upgrade.getUnitToUpgradeTo().name,
|
val upgradeIcon = ImageGetter.getUnitIcon(unit.upgrade.getUnitToUpgradeTo().name,
|
||||||
if (enable) Color.GREEN else Color.GREEN.darken(0.5f))
|
if (enable) Color.GREEN else Color.GREEN.darken(0.5f))
|
||||||
if (enable) upgradeIcon.onClick {
|
if (enable) upgradeIcon.onClick {
|
||||||
|
@ -206,12 +206,10 @@ class WorldMapHolder(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun onTileRightClicked(unit: MapUnit, tile: Tile) {
|
private fun onTileRightClicked(unit: MapUnit, tile: Tile) {
|
||||||
if (UncivGame.Current.gameInfo!!.getCurrentPlayerCivilization().isSpectator()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
removeUnitActionOverlay()
|
removeUnitActionOverlay()
|
||||||
selectedTile = tile
|
selectedTile = tile
|
||||||
unitMovementPaths.clear()
|
unitMovementPaths.clear()
|
||||||
|
if (!worldScreen.canChangeState) return
|
||||||
|
|
||||||
// Concurrency might open up a race condition window - if worldScreen.shouldUpdate is on too
|
// Concurrency might open up a race condition window - if worldScreen.shouldUpdate is on too
|
||||||
// early, concurrent code might possibly call worldScreen.render() and then our request will be
|
// early, concurrent code might possibly call worldScreen.render() and then our request will be
|
||||||
|
Reference in New Issue
Block a user