Solved strange concurrency crashes due to players keypress-activating disabled buttons

This commit is contained in:
Yair Morgenstern 2023-06-28 10:45:36 +03:00
parent bef1843cd9
commit ee855b8d77
2 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package com.unciv.ui.components.input package com.unciv.ui.components.input
import com.badlogic.gdx.scenes.scene2d.Actor import com.badlogic.gdx.scenes.scene2d.Actor
import com.badlogic.gdx.scenes.scene2d.Touchable
import com.unciv.models.UncivSound import com.unciv.models.UncivSound
internal class ActorAttachments private constructor(actor: Actor) { internal class ActorAttachments private constructor(actor: Actor) {
@ -37,6 +38,7 @@ internal class ActorAttachments private constructor(actor: Actor) {
fun activate(type: ActivationTypes): Boolean { fun activate(type: ActivationTypes): Boolean {
if (!this::activationActions.isInitialized) return false if (!this::activationActions.isInitialized) return false
if (this.actor.touchable != Touchable.enabled) return false
return activationActions.activate(type) return activationActions.activate(type)
} }

View File

@ -600,7 +600,7 @@ class WorldScreen(
if (originalGameInfo.gameParameters.isOnlineMultiplayer) { if (originalGameInfo.gameParameters.isOnlineMultiplayer) {
try { try {
game.onlineMultiplayer.updateGame(gameInfoClone) game.onlineMultiplayer.updateGame(gameInfoClone)
}catch (ex: Exception) { } catch (ex: Exception) {
when (ex) { when (ex) {
is MultiplayerAuthException -> { is MultiplayerAuthException -> {
launchOnGLThread { launchOnGLThread {