mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-23 03:23:17 -04:00
Resolved #12893 - Fixed crash when moving selected spies via long-click
This commit is contained in:
parent
733ad64f54
commit
cb6d99ae20
@ -167,6 +167,8 @@ class UnitTable(val worldScreen: WorldScreen) : Table() {
|
||||
|
||||
fun update() {
|
||||
closeButton.isVisible = true
|
||||
|
||||
if (!presenter.shouldBeShown()) summaryPresenter
|
||||
presenter.update()
|
||||
|
||||
// more efficient to do this check once for both
|
||||
@ -275,5 +277,6 @@ class UnitTable(val worldScreen: WorldScreen) : Table() {
|
||||
fun update() {}
|
||||
/** only called when [UnitTable.shouldUpdate] is true */
|
||||
fun updateWhenNeeded() {}
|
||||
fun shouldBeShown(): Boolean { return true}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,8 @@ class SpyPresenter(private val unitTable: UnitTable) : UnitTable.Presenter {
|
||||
selectedSpy = spy
|
||||
}
|
||||
|
||||
override fun shouldBeShown(): Boolean = selectedSpy != null
|
||||
|
||||
override fun updateWhenNeeded() = with(unitTable) {
|
||||
val spy = selectedSpy!!
|
||||
unitNameLabel.clearListeners()
|
||||
|
Loading…
x
Reference in New Issue
Block a user