mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-10 12:51:16 +07:00
Throw exception when attempting to move a unit to a tile that already contains one
This commit is contained in:
parent
af47880f48
commit
90baebc63d
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user