Pass in civ for building on tiles (#11861)

This commit is contained in:
SeventhM 2024-06-27 13:26:38 -07:00 committed by GitHub
parent bebc769120
commit e5e52fe916
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -157,14 +157,14 @@ class TileImprovementFunctions(val tile: Tile) {
// Can't build if the improvement specifically prevents building on some present feature
improvement.getMatchingUniques(UniqueType.CannotBuildOnTile, stateForConditionals).any {
unique -> tile.matchesTerrainFilter(unique.params[0])
unique -> tile.matchesFilter(unique.params[0], stateForConditionals.civInfo)
} ->
false
// Can't build if an improvement is only allowed to be built on specific tiles and this is not one of them
// If multiple uniques of this type exists, we want all to match (e.g. Hill _and_ Forest would be meaningful)
improvement.getMatchingUniques(UniqueType.CanOnlyBeBuiltOnTile, stateForConditionals).let {
it.any() && it.any { unique -> !tile.matchesTerrainFilter(unique.params[0]) }
it.any() && it.any { unique -> !tile.matchesFilter(unique.params[0], stateForConditionals.civInfo) }
} -> false
// Can't build if the improvement requires an adjacent terrain that is not present