mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 20:31:51 -04:00
Sped up FindShortestPath alg
When finding shortest path, we no longer check intermediary tiles for the next step, since they will always have a longer path than the edge tiles (since from there, we need to pass through an edge tile anyway)
This commit is contained in:
parent
26b19271ff
commit
eac8afef75
@ -81,9 +81,9 @@ class UnitMovementAlgorithms(val tileMap: TileMap){
|
||||
|
||||
if(newTilesToCheck.isEmpty()) return emptyList() // there is NO PATH (eg blocked by enemy units)
|
||||
|
||||
tilesToCheck = newTilesToCheck
|
||||
tilesToCheck = newTilesToCheck.filterNot {tile -> tile.neighbors.all{newTilesToCheck.contains(it) || tilesToCheck.contains(it) } }
|
||||
distance++
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user