Fixed crash when selecting certain buildings in the civilopedia (#4819)

This commit is contained in:
Xander Lenstra 2021-08-09 12:57:13 +02:00 committed by GitHub
parent bf40779605
commit 6d04bf424b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -1125,14 +1125,14 @@
"culture": 3, "culture": 3,
"happiness": 1, "happiness": 1,
"specialistSlots": {"Artist": 1}, "specialistSlots": {"Artist": 1},
"uniques": ["Unbuildable"] "uniques": ["Unbuildable", "Hidden when religion is disabled"]
}, },
{ {
"name": "Monastery", "name": "Monastery",
"cost": 0, "cost": 0,
"culture": 2, "culture": 2,
"faith": 2, "faith": 2,
"uniques": ["[+1 Culture, +1 Faith] from [Wine] tiles [in this city]", "uniques": ["[+1 Culture, +1 Faith] from [Wine] tiles [in this city]", "Hidden when religion is disabled",
"[+1 Culture, +1 Faith] from [Incense] tiles [in this city]","Unbuildable"] "[+1 Culture, +1 Faith] from [Incense] tiles [in this city]","Unbuildable"]
}, },
{ {
@ -1141,7 +1141,7 @@
"culture": 2, "culture": 2,
"faith": 3, "faith": 3,
"happiness": 1, "happiness": 1,
"uniques": ["Unbuildable"] "uniques": ["Unbuildable", "Hidden when religion is disabled"]
}, },
{ {
"name": "Pagoda", "name": "Pagoda",
@ -1149,6 +1149,6 @@
"culture": 2, "culture": 2,
"faith": 2, "faith": 2,
"happiness": 2, "happiness": 2,
"uniques": ["Unbuildable"] "uniques": ["Unbuildable", "Hidden when religion is disabled"]
}, },
] ]

View File

@ -203,7 +203,7 @@ class Building : NamedStats(), INonPerpetualConstruction, ICivilopediaText {
override fun canBePurchasedWithStat(cityInfo: CityInfo, stat: Stat, ignoreCityRequirements: Boolean): Boolean { override fun canBePurchasedWithStat(cityInfo: CityInfo, stat: Stat, ignoreCityRequirements: Boolean): Boolean {
if (stat == Stat.Gold && isAnyWonder()) return false if (stat == Stat.Gold && isAnyWonder()) return false
// May buy [buildingFilter] buildings for [amount] [Stat] [cityFilter] // May buy [buildingFilter] buildings for [amount] [Stat] [cityFilter]
if (cityInfo.getMatchingUniques("May buy [] buildings for [] [] []") if (!ignoreCityRequirements && cityInfo.getMatchingUniques("May buy [] buildings for [] [] []")
.any { it.params[2] == stat.name && matchesFilter(it.params[0]) && cityInfo.matchesFilter(it.params[3]) } .any { it.params[2] == stat.name && matchesFilter(it.params[0]) && cityInfo.matchesFilter(it.params[3]) }
) return true ) return true
return super.canBePurchasedWithStat(cityInfo, stat, ignoreCityRequirements) return super.canBePurchasedWithStat(cityInfo, stat, ignoreCityRequirements)