mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 05:09:25 +07:00
Minor bugfix
This commit is contained in:
@ -146,6 +146,8 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
|||||||
}
|
}
|
||||||
} else { // If the tile is far away, we need to build a path how to get there, and then take the first step
|
} else { // If the tile is far away, we need to build a path how to get there, and then take the first step
|
||||||
val path = getShortestPath(destination)
|
val path = getShortestPath(destination)
|
||||||
|
class UnreachableDestinationException:Exception()
|
||||||
|
if(path.isEmpty()) throw UnreachableDestinationException()
|
||||||
destinationTileThisTurn = path.first()
|
destinationTileThisTurn = path.first()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,9 +61,11 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
|
|||||||
|
|
||||||
if(selectedUnit.currentMovement>0)
|
if(selectedUnit.currentMovement>0)
|
||||||
moveHereGroup.onClick {
|
moveHereGroup.onClick {
|
||||||
selectedUnit.movementAlgs().headTowards(tileInfo)
|
if(selectedUnit.movementAlgs().canReach(tileInfo)) {
|
||||||
if(selectedUnit.currentTile != tileInfo)
|
selectedUnit.movementAlgs().headTowards(tileInfo)
|
||||||
selectedUnit.action = "moveTo " + tileInfo.position.x.toInt() + "," + tileInfo.position.y.toInt()
|
if (selectedUnit.currentTile != tileInfo)
|
||||||
|
selectedUnit.action = "moveTo " + tileInfo.position.x.toInt() + "," + tileInfo.position.y.toInt()
|
||||||
|
}
|
||||||
|
|
||||||
worldScreen.update()
|
worldScreen.update()
|
||||||
overlayActor!!.remove()
|
overlayActor!!.remove()
|
||||||
|
Reference in New Issue
Block a user