mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-14 01:39:40 +07:00
chore: isRemovable(terrain) returns if the tile improvement is actually buildable
This commit is contained in:
@ -362,7 +362,7 @@ class WorkerAutomation(
|
|||||||
|
|
||||||
val lastTerrain = tile.lastTerrain
|
val lastTerrain = tile.lastTerrain
|
||||||
|
|
||||||
fun isRemovable(terrain: Terrain): Boolean = ruleSet.tileImprovements.containsKey(Constants.remove + terrain.name)
|
fun isRemovable(terrain: Terrain): Boolean = potentialTileImprovements.containsKey(Constants.remove + terrain.name)
|
||||||
|
|
||||||
val improvementStringForResource: String? = when {
|
val improvementStringForResource: String? = when {
|
||||||
tile.resource == null || !tile.hasViewableResource(civInfo) -> null
|
tile.resource == null || !tile.hasViewableResource(civInfo) -> null
|
||||||
@ -372,7 +372,6 @@ class WorkerAutomation(
|
|||||||
&& isRemovable(lastTerrain)
|
&& isRemovable(lastTerrain)
|
||||||
&& !tile.providesResources(civInfo)
|
&& !tile.providesResources(civInfo)
|
||||||
&& !isResourceImprovementAllowedOnFeature(tile, potentialTileImprovements)
|
&& !isResourceImprovementAllowedOnFeature(tile, potentialTileImprovements)
|
||||||
&& potentialTileImprovements.containsKey(Constants.remove + lastTerrain.name)
|
|
||||||
-> Constants.remove + lastTerrain.name
|
-> Constants.remove + lastTerrain.name
|
||||||
|
|
||||||
else -> tile.tileResource.getImprovements().filter { it in potentialTileImprovements || it == tile.improvement }
|
else -> tile.tileResource.getImprovements().filter { it in potentialTileImprovements || it == tile.improvement }
|
||||||
@ -400,7 +399,6 @@ class WorkerAutomation(
|
|||||||
|
|
||||||
lastTerrain.let {
|
lastTerrain.let {
|
||||||
isRemovable(it)
|
isRemovable(it)
|
||||||
&& potentialTileImprovements.containsKey(Constants.remove + lastTerrain.name)
|
|
||||||
&& (Automation.rankStatsValue(it, civInfo) < 0 || it.hasUnique(UniqueType.NullifyYields))
|
&& (Automation.rankStatsValue(it, civInfo) < 0 || it.hasUnique(UniqueType.NullifyYields))
|
||||||
} -> Constants.remove + lastTerrain.name
|
} -> Constants.remove + lastTerrain.name
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user