mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04:00
Fix great general automation exception.
This commit is contained in:
parent
05657ea131
commit
2e91b9f84e
@ -413,7 +413,7 @@ class SpecificUnitAutomation{
|
|||||||
|
|
||||||
//if no unit to follow, take refuge in city.
|
//if no unit to follow, take refuge in city.
|
||||||
val cityToGarison = unit.civInfo.cities.map {it.getCenterTile()}
|
val cityToGarison = unit.civInfo.cities.map {it.getCenterTile()}
|
||||||
.filter {it.civilianUnit == null && unit.canMoveTo(it)}
|
.filter {it.civilianUnit == null && unit.canMoveTo(it) && unit.movementAlgs().canReach(it)}
|
||||||
.minBy { it.arialDistanceTo(unit.currentTile) }
|
.minBy { it.arialDistanceTo(unit.currentTile) }
|
||||||
if (cityToGarison != null) {
|
if (cityToGarison != null) {
|
||||||
unit.movementAlgs().headTowards(cityToGarison)
|
unit.movementAlgs().headTowards(cityToGarison)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user