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

(cherry picked from commit 6d04bf424b)
This commit is contained in:
Xander Lenstra 2021-08-09 12:57:13 +02:00 committed by yairm210
parent 7cd368d024
commit 421cce0a43
2 changed files with 5 additions and 5 deletions

View File

@ -1125,14 +1125,14 @@
"culture": 3,
"happiness": 1,
"specialistSlots": {"Artist": 1},
"uniques": ["Unbuildable"]
"uniques": ["Unbuildable", "Hidden when religion is disabled"]
},
{
"name": "Monastery",
"cost": 0,
"culture": 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"]
},
{
@ -1141,7 +1141,7 @@
"culture": 2,
"faith": 3,
"happiness": 1,
"uniques": ["Unbuildable"]
"uniques": ["Unbuildable", "Hidden when religion is disabled"]
},
{
"name": "Pagoda",
@ -1149,6 +1149,6 @@
"culture": 2,
"faith": 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 {
if (stat == Stat.Gold && isAnyWonder()) return false
// 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]) }
) return true
return super.canBePurchasedWithStat(cityInfo, stat, ignoreCityRequirements)