Prevent some state changing actions during next-turn (#9327)

* Prevent some state changing actions during next-turn

* Direct canChangeState
This commit is contained in:
SomeTroglodyte 2023-05-10 10:39:48 +02:00 committed by GitHub
parent a858e45ec4
commit 1df7ee46ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -263,7 +263,8 @@ class UnitOverviewTab(
// Upgrade column
if (unit.upgrade.canUpgrade()) {
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,
if (enable) Color.GREEN else Color.GREEN.darken(0.5f))
if (enable) upgradeIcon.onClick {

View File

@ -206,12 +206,10 @@ class WorldMapHolder(
}
private fun onTileRightClicked(unit: MapUnit, tile: Tile) {
if (UncivGame.Current.gameInfo!!.getCurrentPlayerCivilization().isSpectator()) {
return
}
removeUnitActionOverlay()
selectedTile = tile
unitMovementPaths.clear()
if (!worldScreen.canChangeState) return
// 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