mirror of
https://github.com/yairm210/Unciv.git
synced 2025-08-03 00:29:18 +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,
|
// 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,
|
// 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.
|
// but only for the tile that's about to be chosen.
|
||||||
while (workableTiles.isNotEmpty()
|
val selectedTile = workableTiles.firstOrNull{
|
||||||
&& UnitMovementAlgorithms(currentTile.tileMap)
|
UnitMovementAlgorithms(currentTile.tileMap)
|
||||||
.getShortestPath(currentTile.position, workableTiles.first().position,2f, 2, civInfo)
|
.getShortestPath(currentTile.position, workableTiles.first().position,2f, 2, civInfo)
|
||||||
.isEmpty())
|
.isNotEmpty()}
|
||||||
workableTiles.removeAt(0)
|
|
||||||
|
|
||||||
val selectedTile = workableTiles.firstOrNull()
|
|
||||||
if (selectedTile != null
|
if (selectedTile != null
|
||||||
&& getPriority(selectedTile, civInfo)>1
|
&& getPriority(selectedTile, civInfo)>1
|
||||||
&& (!workableTiles.contains(currentTile)
|
&& (!workableTiles.contains(currentTile)
|
||||||
|
Reference in New Issue
Block a user