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