mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-20 09:17:47 +07:00
Fixed edge-case bug where a tile that a unit was headed towards becomes unreachable afterwards
This commit is contained in:
parent
5aef49955a
commit
7c26daaed2
@ -43,7 +43,9 @@ class MapUnit {
|
||||
if (action != null && action!!.startsWith("moveTo")) {
|
||||
val destination = action!!.replace("moveTo ", "").split(",").dropLastWhile { it.isEmpty() }.toTypedArray()
|
||||
val destinationVector = Vector2(Integer.parseInt(destination[0]).toFloat(), Integer.parseInt(destination[1]).toFloat())
|
||||
val gotTo = movementAlgs().headTowards(currentTile.tileMap[destinationVector])
|
||||
val destinationTile = currentTile.tileMap[destinationVector]
|
||||
if(!movementAlgs().canReach(destinationTile)) return // That tile that we were moving towards is now unreachable
|
||||
val gotTo = movementAlgs().headTowards(destinationTile)
|
||||
if(gotTo==currentTile) // We didn't move at all
|
||||
return
|
||||
if (gotTo.position == destinationVector) action = null
|
||||
|
Loading…
Reference in New Issue
Block a user