From 0321aed309270d4c30c4a387d2880af72ab62a47 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 21 Apr 2020 20:34:02 +0300 Subject: [PATCH] Solved a concurrent modification bug, a second before publish --- core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt index 4caae2447c..7915ba0d69 100644 --- a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt +++ b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt @@ -255,7 +255,9 @@ class UnitMovementAlgorithms(val unit:MapUnit) { unit.removeFromTile() unit.putInTile(destination) - for (payload in origin.getUnits().filter { it.isTransported }) { // bring along the payloads + // The .toList() here is because we have a sequence that's running on the units in the tile, + // then if we move one of the units we'll get a ConcurrentModificationException, se we save them all to a list + for (payload in origin.getUnits().filter { it.isTransported }.toList()) { // bring along the payloads if (unit.canTransport(payload)) { payload.removeFromTile() payload.putInTile(destination)