diff --git a/core/src/com/unciv/logic/event/EventBus.kt b/core/src/com/unciv/logic/event/EventBus.kt index 82a15803cc..79b37624ab 100644 --- a/core/src/com/unciv/logic/event/EventBus.kt +++ b/core/src/com/unciv/logic/event/EventBus.kt @@ -1,5 +1,7 @@ package com.unciv.logic.event +import com.unciv.logic.event.EventBus.EventReceiver +import com.unciv.logic.event.EventBus.send import java.lang.ref.WeakReference import kotlin.reflect.KClass @@ -85,7 +87,7 @@ object EventBus { private fun cleanUp(eventHandlers: Map, MutableList>) { for ((kClass, toRemove) in eventHandlers) { val registeredListeners = listeners.get(kClass) - registeredListeners?.removeIf { + registeredListeners?.removeAll { val eventHandler = it.eventHandler.get() eventHandler == null || (eventHandler as Any) in toRemove } diff --git a/core/src/com/unciv/logic/map/mapunit/movement/UnitMovement.kt b/core/src/com/unciv/logic/map/mapunit/movement/UnitMovement.kt index 0d8abb4fd9..2e635bc05e 100644 --- a/core/src/com/unciv/logic/map/mapunit/movement/UnitMovement.kt +++ b/core/src/com/unciv/logic/map/mapunit/movement/UnitMovement.kt @@ -712,7 +712,7 @@ class UnitMovement(val unit: MapUnit) { // We should only be able to move to tiles that our escort can also move to val escortDistanceToTiles = unit.getOtherEscortUnit()!!.movement .getDistanceToTiles(considerZoneOfControl, includeOtherEscortUnit = false) - distanceToTiles.keys.removeIf { !escortDistanceToTiles.containsKey(it) } + distanceToTiles.keys.removeAll { !escortDistanceToTiles.containsKey(it) } } } return distanceToTiles diff --git a/core/src/com/unciv/ui/components/input/KeyShortcutDispatcher.kt b/core/src/com/unciv/ui/components/input/KeyShortcutDispatcher.kt index 14168987cd..a3e1bd01ea 100644 --- a/core/src/com/unciv/ui/components/input/KeyShortcutDispatcher.kt +++ b/core/src/com/unciv/ui/components/input/KeyShortcutDispatcher.kt @@ -18,7 +18,7 @@ open class KeyShortcutDispatcher { fun add(shortcut: KeyShortcut?, action: ActivationAction?) { if (action == null || shortcut == null) return - shortcuts.removeIf { it.shortcut == shortcut } + shortcuts.removeAll { it.shortcut == shortcut } shortcuts.add(ShortcutAction(shortcut, action)) } @@ -42,23 +42,23 @@ open class KeyShortcutDispatcher { } fun remove(shortcut: KeyShortcut?) { - shortcuts.removeIf { it.shortcut == shortcut } + shortcuts.removeAll { it.shortcut == shortcut } } fun remove(binding: KeyboardBinding) { - shortcuts.removeIf { it.shortcut.binding == binding } + shortcuts.removeAll { it.shortcut.binding == binding } } fun remove(key: KeyCharAndCode?) { - shortcuts.removeIf { it.shortcut.key == key } + shortcuts.removeAll { it.shortcut.key == key } } fun remove(char: Char?) { - shortcuts.removeIf { it.shortcut.key.char == char } + shortcuts.removeAll { it.shortcut.key.char == char } } fun remove(keyCode: Int?) { - shortcuts.removeIf { it.shortcut.key.code == keyCode } + shortcuts.removeAll { it.shortcut.key.code == keyCode } } open fun isActive(): Boolean = true