Fix: Freshly improved resources often do not show up on world screen, overview or trade (#2182)

Issue visible right at start of turn, saving and reloading viable workaround.
This commit is contained in:
rh-github-2015 2020-03-18 08:55:10 +01:00 committed by GitHub
parent e8f63ef996
commit 076821a181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -371,6 +371,7 @@ class MapUnit {
&& 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!
if (tile.resource!=null) civInfo.updateDetailedCivResources() // unlikely, but maybe a mod makes a resource improvement dependent on a terrain feature
}
if(tile.improvementInProgress=="Remove Road" || tile.improvementInProgress=="Remove Railroad")
tile.roadStatus = RoadStatus.None
@ -378,7 +379,10 @@ class MapUnit {
}
tile.improvementInProgress == "Road" -> tile.roadStatus = RoadStatus.Road
tile.improvementInProgress == "Railroad" -> tile.roadStatus = RoadStatus.Railroad
else -> tile.improvement = tile.improvementInProgress
else -> {
tile.improvement = tile.improvementInProgress
if (tile.resource!=null) civInfo.updateDetailedCivResources()
}
}
tile.improvementInProgress = null
}

View File

@ -176,6 +176,7 @@ object UnitActions {
tile.turnsToImprovement = 2
}
tile.improvement = null
if (tile.resource!=null) tile.getOwner()?.updateDetailedCivResources() // this might take away a resource
if (!unit.hasUnique("No movement cost to pillage")) unit.useMovementPoints(1f)
unit.healBy(25)
}.takeIf { unit.currentMovement > 0 && canPillage(unit, tile) })