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:
parent
e9bb834bac
commit
d22da73636
1 changed files with 2 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue