When removing a terrain (e.g. Forest) whose improvement depends on it (e.g. Lumber mill), the improvement is removed
This commit is contained in:
parent
6ca586c3b1
commit
43ef42be5f
1 changed files with 10 additions and 1 deletions
|
@ -77,7 +77,16 @@ class MapUnit {
|
|||
tile.turnsToImprovement -= 1
|
||||
if (tile.turnsToImprovement != 0) return
|
||||
when {
|
||||
tile.improvementInProgress!!.startsWith("Remove") -> tile.terrainFeature = null
|
||||
tile.improvementInProgress!!.startsWith("Remove") -> {
|
||||
val tileImprovement = tile.tileImprovement
|
||||
if(tileImprovement!=null
|
||||
&& tileImprovement.terrainsCanBeBuiltOn.contains(tile.terrainFeature)
|
||||
&& !tileImprovement.terrainsCanBeBuiltOn.contains(tile.baseTerrain)) {
|
||||
tile.improvement = null // We removed a terrain (e.g. Forest) and the improvement (e.g. Lumber mill) requires it!
|
||||
}
|
||||
|
||||
tile.terrainFeature = null
|
||||
}
|
||||
tile.improvementInProgress == "Road" -> tile.roadStatus = RoadStatus.Road
|
||||
tile.improvementInProgress == "Railroad" -> tile.roadStatus = RoadStatus.Railroad
|
||||
else -> tile.improvement = tile.improvementInProgress
|
||||
|
|
Loading…
Reference in a new issue