diff --git a/core/src/com/unciv/logic/automation/civilization/NextTurnAutomation.kt b/core/src/com/unciv/logic/automation/civilization/NextTurnAutomation.kt index 6a3c88688ee67..290ea6ce40cbe 100644 --- a/core/src/com/unciv/logic/automation/civilization/NextTurnAutomation.kt +++ b/core/src/com/unciv/logic/automation/civilization/NextTurnAutomation.kt @@ -262,7 +262,7 @@ object NextTurnAutomation { } val stateForConditionals = civInfo.state - while(civInfo.tech.freeTechs > 0) { + while (civInfo.tech.freeTechs > 0) { val costs = getGroupedResearchableTechs() if (costs.isEmpty()) return diff --git a/core/src/com/unciv/ui/components/tilegroups/layers/TileLayerTerrain.kt b/core/src/com/unciv/ui/components/tilegroups/layers/TileLayerTerrain.kt index cd27ec9f050a2..0777f987c2ac9 100644 --- a/core/src/com/unciv/ui/components/tilegroups/layers/TileLayerTerrain.kt +++ b/core/src/com/unciv/ui/components/tilegroups/layers/TileLayerTerrain.kt @@ -102,11 +102,11 @@ class TileLayerTerrain(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup, .flatMap { getMatchingEdges(tile, it) } } - private fun getMatchingEdges(originTile: Tile, neighborTile: Tile): List{ + private fun getMatchingEdges(originTile: Tile, neighborTile: Tile): Sequence{ val vectorToNeighbor = neighborTile.position.cpy().sub(originTile.position) val direction = NeighborDirection.fromVector(vectorToNeighbor) - ?: return emptyList() - val possibleEdgeFiles = strings().edgeImagesByPosition[direction] ?: return emptyList() + ?: return emptySequence() + val possibleEdgeFiles = strings().edgeImagesByPosition[direction] ?: return emptySequence() // Required for performance - full matchesFilter is too expensive for something that needs to run every update() fun matchesFilterMinimal(originTile: Tile, filter: String): Boolean { @@ -115,7 +115,7 @@ class TileLayerTerrain(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup, return false } - return possibleEdgeFiles.filter { + return possibleEdgeFiles.asSequence().filter { if (!matchesFilterMinimal(originTile, it.originTileFilter)) return@filter false if (!matchesFilterMinimal(neighborTile, it.destinationTileFilter)) return@filter false return@filter true diff --git a/core/src/com/unciv/ui/screens/mapeditorscreen/EditorMapHolder.kt b/core/src/com/unciv/ui/screens/mapeditorscreen/EditorMapHolder.kt index 01dc5f2d13f03..d1f498ed875cb 100644 --- a/core/src/com/unciv/ui/screens/mapeditorscreen/EditorMapHolder.kt +++ b/core/src/com/unciv/ui/screens/mapeditorscreen/EditorMapHolder.kt @@ -33,7 +33,7 @@ class EditorMapHolder( val tileGroups = HashMap() private lateinit var tileGroupMap: TileGroupMap - private val allTileGroups = ArrayList() + private val allTileGroups = ArrayList(tileMap.values.size) private var blinkAction: Action? = null