mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-23 14:19:15 +07:00
Fixed stack overflow exception that happened when an automated worker tried to move to a neighboring tile and coudn't get there.
This commit is contained in:
@ -25,8 +25,8 @@ class WorkerAutomation(val unit: MapUnit) {
|
||||
}
|
||||
|
||||
if (tileToWork != tile) {
|
||||
unit.movementAlgs().headTowards(tileToWork)
|
||||
unit.doPreTurnAction()
|
||||
val reachedTile = unit.movementAlgs().headTowards(tileToWork)
|
||||
if(reachedTile!=tile) unit.doPreTurnAction() // otherwise, we get a situation where the worker is automated, so it tries to move but doesn't, then tries to automate, then move, etc, forever. Stack overflow exception!
|
||||
return
|
||||
}
|
||||
if (tile.improvementInProgress == null) {
|
||||
|
Reference in New Issue
Block a user