mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
Fixed a bug where great improvements could not be repaired after being pillaged (#5913)
* Fixed a bug where great improvements could not be repaired * Formatting
This commit is contained in:
parent
a5bba8dfb0
commit
d6a99a7848
@ -1104,7 +1104,11 @@ class MapUnit {
|
|||||||
|
|
||||||
fun canBuildImprovement(improvement: TileImprovement, tile: TileInfo = currentTile): Boolean {
|
fun canBuildImprovement(improvement: TileImprovement, tile: TileInfo = currentTile): Boolean {
|
||||||
// Workers (and similar) should never be able to (instantly) construct things, only build them
|
// Workers (and similar) should never be able to (instantly) construct things, only build them
|
||||||
if (improvement.turnsToBuild == 0 && improvement.name != Constants.cancelImprovementOrder) return false
|
// HOWEVER, they should be able to repair such things if they are pillaged
|
||||||
|
if (improvement.turnsToBuild == 0
|
||||||
|
&& improvement.name != Constants.cancelImprovementOrder
|
||||||
|
&& tile.improvementInProgress != improvement.name
|
||||||
|
) return false
|
||||||
val matchingUniques = getMatchingUniques(UniqueType.BuildImprovements)
|
val matchingUniques = getMatchingUniques(UniqueType.BuildImprovements)
|
||||||
return matchingUniques.any { improvement.matchesFilter(it.params[0]) || tile.matchesTerrainFilter(it.params[0]) }
|
return matchingUniques.any { improvement.matchesFilter(it.params[0]) || tile.matchesTerrainFilter(it.params[0]) }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user