If we try to place barbs but there's no room then we just don't place.

This commit is contained in:
Yair Morgenstern 2018-06-10 17:34:00 +03:00
parent 98932473eb
commit d695cbd6f1

View file

@ -58,6 +58,7 @@ class GameInfo {
if(tileToPlace==null) {
val playerViewableTiles = getPlayerCivilization().getViewableTiles().toHashSet()
val viableTiles = tileMap.values.filterNot { playerViewableTiles.contains(it) || it.militaryUnit != null || it.civilianUnit!=null}
if(viableTiles.isEmpty()) return // no place for more barbs =(
tile=viableTiles.getRandom()
}
tileMap.placeUnitNearTile(tile!!.position,"Warrior",getBarbarianCivilization())