mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-31 07:09:26 +07:00
Worker findTileToWork is now more readable
This commit is contained in:
@ -37,13 +37,11 @@ public class WorkerAutomation(){
|
||||
// the tile needs to be actually reachable - more difficult than it seems,
|
||||
// which is why we DON'T calculate this for every possible tile in the radius,
|
||||
// but only for the tile that's about to be chosen.
|
||||
while (workableTiles.isNotEmpty()
|
||||
&& UnitMovementAlgorithms(currentTile.tileMap)
|
||||
.getShortestPath(currentTile.position, workableTiles.first().position,2f, 2, civInfo)
|
||||
.isEmpty())
|
||||
workableTiles.removeAt(0)
|
||||
val selectedTile = workableTiles.firstOrNull{
|
||||
UnitMovementAlgorithms(currentTile.tileMap)
|
||||
.getShortestPath(currentTile.position, workableTiles.first().position,2f, 2, civInfo)
|
||||
.isNotEmpty()}
|
||||
|
||||
val selectedTile = workableTiles.firstOrNull()
|
||||
if (selectedTile != null
|
||||
&& getPriority(selectedTile, civInfo)>1
|
||||
&& (!workableTiles.contains(currentTile)
|
||||
|
Reference in New Issue
Block a user