Fixed bug where if 2 tiles were of same "ranking", the worker would try and switch back and forth between them.

This commit is contained in:
Yair Morgenstern 2018-04-25 22:19:35 +03:00
parent 9816cd57da
commit 6fcf9ec93e
2 changed files with 3 additions and 3 deletions

View File

@ -36,7 +36,7 @@ public class WorkerAutomation(){
.getShortestPath(currentTile.position, it.position, 2f, 2, civInfo).isNotEmpty()
}
.maxBy { getPriority(it, civInfo) }
if (selectedTile != null && getPriority(selectedTile, civInfo) > 1) return selectedTile
if (selectedTile != null && getPriority(selectedTile, civInfo) > getPriority(currentTile,civInfo)) return selectedTile
else return currentTile
}

View File

@ -2,7 +2,7 @@ package com.unciv.ui.worldscreen.unit
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
import com.unciv.UnCivGame
import com.unciv.logic.Automation
import com.unciv.logic.WorkerAutomation
import com.unciv.logic.map.MapUnit
import com.unciv.logic.map.TileInfo
import com.unciv.models.gamebasics.Building
@ -86,7 +86,7 @@ class UnitActions {
actionList += UnitAction("Automate",
{
tile.unit!!.action = "automation"
Automation().automateWorkerAction(tile.unit!!)
WorkerAutomation().automateWorkerAction(tile.unit!!)
},unit.currentMovement != 0f
)
}