mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-20 19:56:51 +01:00
Chore: Slight getShortestPath simplification
This commit is contained in:
parent
50979e8a0e
commit
612375d85d
|
|
@ -106,6 +106,7 @@ class UnitMovement(val unit: MapUnit) {
|
|||
val damageFreePath = getShortestPath(destination, true)
|
||||
if (damageFreePath.isNotEmpty()) return damageFreePath
|
||||
}
|
||||
|
||||
if (destination.neighbors.none { isUnknownTileWeShouldAssumeToBePassable(it) || canPassThrough(it) }) {
|
||||
// edge case where this all of the tiles around the destination are
|
||||
// explored and known the unit can't pass through any of thoes tiles so we know a priori that no path exists
|
||||
|
|
@ -183,15 +184,15 @@ class UnitMovement(val unit: MapUnit) {
|
|||
pathfindingCache.setShortestPathCache(destination, path)
|
||||
|
||||
return path
|
||||
} else {
|
||||
if (movementTreeParents.containsKey(reachableTile)) continue // We cannot be faster than anything existing...
|
||||
if (!isUnknownTileWeShouldAssumeToBePassable(reachableTile) &&
|
||||
!canMoveToCache.getOrPut(reachableTile) { canMoveTo(reachableTile) })
|
||||
// This is a tile that we can't actually enter - either an intermediary tile containing our unit, or an enemy unit/city
|
||||
continue
|
||||
movementTreeParents[reachableTile] = tileToCheck
|
||||
newTilesToCheck.add(reachableTile)
|
||||
}
|
||||
|
||||
if (movementTreeParents.containsKey(reachableTile)) continue // We cannot be faster than anything existing...
|
||||
if (!isUnknownTileWeShouldAssumeToBePassable(reachableTile) &&
|
||||
!canMoveToCache.getOrPut(reachableTile) { canMoveTo(reachableTile) })
|
||||
// This is a tile that we can't actually enter - either an intermediary tile containing our unit, or an enemy unit/city
|
||||
continue
|
||||
movementTreeParents[reachableTile] = tileToCheck
|
||||
newTilesToCheck.add(reachableTile)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
|||
??? example "Gain [amount]-[amount] [stat]"
|
||||
Example: "Gain [3]-[3] [Culture]"
|
||||
|
||||
This unique's effect can be modified with <(modified by game speed)>
|
||||
Applicable to: Triggerable
|
||||
|
||||
??? example "Gain enough Faith for a Pantheon"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user