mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-30 07:21:34 -04:00
Solved "quantum tunneling" bug for new movement algorithm
This commit is contained in:
parent
b0bf18afa0
commit
4d0f66e159
@ -299,7 +299,8 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
|||||||
|
|
||||||
val distanceToTiles = getDistanceToTiles()
|
val distanceToTiles = getDistanceToTiles()
|
||||||
val pathToDestination = distanceToTiles.getPathToTile(destination)
|
val pathToDestination = distanceToTiles.getPathToTile(destination)
|
||||||
val lastReachableTile = pathToDestination.last { canMoveTo(it) }
|
val movableTiles = pathToDestination.takeWhile { canPassThrough(it) }
|
||||||
|
val lastReachableTile = movableTiles.last { canMoveTo(it) }
|
||||||
val pathToLastReachableTile = distanceToTiles.getPathToTile(lastReachableTile)
|
val pathToLastReachableTile = distanceToTiles.getPathToTile(lastReachableTile)
|
||||||
|
|
||||||
if (!unit.civInfo.gameInfo.gameParameters.godMode) {
|
if (!unit.civInfo.gameInfo.gameParameters.godMode) {
|
||||||
@ -419,7 +420,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
|||||||
if (!canPassThrough(tile))
|
if (!canPassThrough(tile))
|
||||||
return false
|
return false
|
||||||
|
|
||||||
if(tile.isCityCenter() && tile.getOwner()!=unit.civInfo) return false // even if they'll let us pass through, we can't enter their city
|
if (tile.isCityCenter() && tile.getOwner() != unit.civInfo) return false // even if they'll let us pass through, we can't enter their city
|
||||||
|
|
||||||
if (unit.type.isCivilian())
|
if (unit.type.isCivilian())
|
||||||
return tile.civilianUnit == null && (tile.militaryUnit == null || tile.militaryUnit!!.owner == unit.owner)
|
return tile.civilianUnit == null && (tile.militaryUnit == null || tile.militaryUnit!!.owner == unit.owner)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user