Select next idle unit only selects units belonging to the player

This commit is contained in:
Yair Morgenstern 2018-04-08 08:55:53 +03:00
parent 3ca20951e5
commit a72c1c7d95

View file

@ -11,7 +11,7 @@ import com.unciv.ui.worldscreen.WorldScreen
class IdleUnitButton internal constructor(internal val worldScreen: WorldScreen) : TextButton("Select next idle unit", CameraStageBaseScreen.skin) {
init {
addClickListener {
val tilesWithIdleUnits = worldScreen.civInfo.gameInfo.tileMap.values.filter { it.hasIdleUnit() }
val tilesWithIdleUnits = worldScreen.civInfo.gameInfo.tileMap.values.filter { it.hasIdleUnit() && it.unit!!.owner == worldScreen.civInfo.civName }
val tileToSelect: TileInfo
if (!tilesWithIdleUnits.contains(worldScreen.tileMapHolder.selectedTile))