mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-19 12:18:53 +07:00
Modded "Remove" commands to nonexistant features no longer crashes the game
This commit is contained in:
@ -411,12 +411,13 @@ class MapUnit {
|
||||
if (tile.improvementInProgress == "Remove Road" || tile.improvementInProgress == "Remove Railroad")
|
||||
tile.roadStatus = RoadStatus.None
|
||||
else {
|
||||
val removedFeature = tile.improvementInProgress!!.removePrefix("Remove ")
|
||||
if (tile.ruleset.terrains[removedFeature]!!.uniques
|
||||
val removedFeatureName = tile.improvementInProgress!!.removePrefix("Remove ")
|
||||
val removedFeatureObject = tile.ruleset.terrains[removedFeatureName]
|
||||
if (removedFeatureObject!=null && removedFeatureObject.uniques
|
||||
.contains("Provides a one-time Production bonus to the closest city when cut down")) {
|
||||
tryProvideProductionToClosestCity(removedFeature)
|
||||
tryProvideProductionToClosestCity(removedFeatureName)
|
||||
}
|
||||
tile.terrainFeatures.remove(removedFeature)
|
||||
tile.terrainFeatures.remove(removedFeatureName)
|
||||
}
|
||||
}
|
||||
tile.improvementInProgress == "Road" -> tile.roadStatus = RoadStatus.Road
|
||||
|
Reference in New Issue
Block a user