Resolved #2406 - land units prefer to be generated in land tiles
This commit is contained in:
parent
85e1476efb
commit
dd8acda4c0
1 changed files with 3 additions and 1 deletions
|
@ -144,7 +144,9 @@ class TileMap {
|
|||
var tryCount = 0
|
||||
var potentialCandidates = getPassableNeighbours(currentTile)
|
||||
while (unitToPlaceTile == null && tryCount++ < 10) {
|
||||
unitToPlaceTile = potentialCandidates.firstOrNull { unit.movement.canMoveTo(it) }
|
||||
unitToPlaceTile = potentialCandidates
|
||||
.sortedByDescending { if(unit.type.isLandUnit()) it.isLand else true } // Land units should prefer to go into land tiles
|
||||
.firstOrNull { unit.movement.canMoveTo(it) }
|
||||
if (unitToPlaceTile != null) continue
|
||||
// if it's not found yet, let's check their neighbours
|
||||
val newPotentialCandidates = mutableSetOf<TileInfo>()
|
||||
|
|
Loading…
Reference in a new issue