Thwart the nathty dithband thpammer (#11790)

This commit is contained in:
SomeTroglodyte 2024-06-19 16:12:47 +02:00 committed by GitHub
parent 9431e3cbc4
commit 33f73f5aae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -933,6 +933,9 @@ class MapUnit : IsPartOfGameInfoSerialization {
}
fun disband() {
// Safeguard against running on already destroyed instances
if (isDestroyed) return
// evacuation of transported units before disbanding, if possible. toListed because we're modifying the unit list.
for (unit in currentTile.getUnits()
.filter { it.isTransported && isTransportTypeOf(it) }

View File

@ -60,6 +60,7 @@ class UnitActionsTable(val worldScreen: WorldScreen) : Table() {
}
clear()
keyShortcuts.clear()
if (unit == null) return
if (!worldScreen.canChangeState) return // No actions when it's not your turn or spectator!
@ -127,7 +128,6 @@ class UnitActionsTable(val worldScreen: WorldScreen) : Table() {
pack()
// Bind all currently invisible actions to their keys
keyShortcuts.clear()
for (page in pageActionBuckets.indices) {
if (page == currentPage) continue // these are already done
for (unitAction in pageActionBuckets[page]) {