From 90baebc63d921772497473532f35606251266298 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 9 Apr 2018 11:08:20 +0300 Subject: [PATCH] Throw exception when attempting to move a unit to a tile that already contains one --- core/src/com/unciv/logic/map/MapUnit.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/com/unciv/logic/map/MapUnit.kt b/core/src/com/unciv/logic/map/MapUnit.kt index 2d17087a5f..3610614bb2 100644 --- a/core/src/com/unciv/logic/map/MapUnit.kt +++ b/core/src/com/unciv/logic/map/MapUnit.kt @@ -179,6 +179,7 @@ class MapUnit { fun moveToTile(otherTile: TileInfo) { val distanceToTiles = getDistanceToTiles() if (!distanceToTiles.containsKey(otherTile)) throw Exception("You can't get there from here!") + if (otherTile.unit != null ) throw Exception("Tile already contains a unit!") currentMovement -= distanceToTiles[otherTile]!! if (currentMovement < 0.1) currentMovement = 0f // silly floats which are "almost zero"