mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-05 21:11:35 +07:00
Resolved #9740 - incorrect ruleset combos for 'buy building with stat' no longer crash
This commit is contained in:
parent
103234a6b8
commit
fdb07b06c1
@ -492,7 +492,12 @@ class Civilization : IsPartOfGameInfoSerialization {
|
||||
return tech.currentTechnology() == null && cities.isNotEmpty()
|
||||
}
|
||||
|
||||
fun getEquivalentBuilding(buildingName: String) = getEquivalentBuilding(gameInfo.ruleset.buildings[buildingName]!!)
|
||||
fun getEquivalentBuilding(buildingName: String): Building {
|
||||
val building = gameInfo.ruleset.buildings[buildingName]
|
||||
?: throw Exception("No building by the name of $buildingName exists!")
|
||||
return getEquivalentBuilding(building)
|
||||
}
|
||||
|
||||
fun getEquivalentBuilding(baseBuilding: Building): Building {
|
||||
if (baseBuilding.replaces != null)
|
||||
return getEquivalentBuilding(baseBuilding.replaces!!)
|
||||
|
@ -108,6 +108,6 @@ class Religion() : INamed, IsPartOfGameInfoSerialization {
|
||||
belief.getMatchingUniques(UniqueType.BuyBuildingsWithStat).map { it.params[0] } +
|
||||
belief.getMatchingUniques(UniqueType.BuyBuildingsForAmountStat).map { it.params[0] } +
|
||||
belief.getMatchingUniques(UniqueType.BuyBuildingsIncreasingCost).map { it.params[0] }
|
||||
}.toList()
|
||||
}.filter { gameInfo.ruleset.buildings.containsKey(it) }.toList()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user