Throw exception when attempting to move a unit to a tile that already contains one
This commit is contained in:
parent
af47880f48
commit
90baebc63d
1 changed files with 1 additions and 0 deletions
|
@ -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 a new issue