From ee9f735e9fc86a0e11fe2dc0b37c0c1a7a099054 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 8 Oct 2023 12:56:59 +0300 Subject: [PATCH] chore: Removed dead functions --- core/src/com/unciv/logic/map/TileMap.kt | 7 ------- core/src/com/unciv/logic/map/tile/Tile.kt | 10 +--------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/core/src/com/unciv/logic/map/TileMap.kt b/core/src/com/unciv/logic/map/TileMap.kt index ad4f65f242..b61fb0e153 100644 --- a/core/src/com/unciv/logic/map/TileMap.kt +++ b/core/src/com/unciv/logic/map/TileMap.kt @@ -407,13 +407,6 @@ class TileMap(initialCapacity: Int = 10) : IsPartOfGameInfoSerialization { return viewableTiles.filter { it.isVisible }.map { it.tile } } - /** Strips all units from [TileMap] - * @return stripped [clone] of [TileMap] - */ - fun stripAllUnits(): TileMap { - return clone().apply { tileList.forEach { it.stripUnits() } } - } - /** Build a list of incompatibilities of a map with a ruleset for the new game loader * * Is run before setTransients, so make do without startingLocationsByNation diff --git a/core/src/com/unciv/logic/map/tile/Tile.kt b/core/src/com/unciv/logic/map/tile/Tile.kt index 4c761d89b1..13c1ff5361 100644 --- a/core/src/com/unciv/logic/map/tile/Tile.kt +++ b/core/src/com/unciv/logic/map/tile/Tile.kt @@ -437,7 +437,6 @@ open class Tile : IsPartOfGameInfoSerialization { val owner = getOwner() ?: return false val unit = militaryUnit - // If tile has unit if (unit != null) { return when { unit.civ == owner -> false // Own - unblocks tile; @@ -446,15 +445,12 @@ open class Tile : IsPartOfGameInfoSerialization { } } - // No unit -> land tile is not blocked - if (isLand) + if (isLand) // Only water tiles are blocked if empty return false // For water tiles need also to check neighbors: // enemy military naval units blockade all adjacent water tiles. for (neighbor in neighbors) { - - // Check only water neighbors if (!neighbor.isWater) continue @@ -780,10 +776,6 @@ open class Tile : IsPartOfGameInfoSerialization { getRoadOwner()!!.neutralRoads.add(this.position) } - fun stripUnits() { - for (unit in this.getUnits()) removeUnit(unit) - } - /** * Sets this tile's [resource] and, if [newResource] is a Strategic resource, [resourceAmount] fields. *