Fix crash at conquest, empty religion icon (#4927)

This commit is contained in:
SomeTroglodyte 2021-08-21 20:00:59 +02:00 committed by GitHub
parent 13365e5ad6
commit 5c51e3d38e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -190,13 +190,13 @@ class CityInfoReligionManager {
* Should be called whenever a city changes hands, e.g. conquering and trading
*/
fun removeUnknownPantheons() {
for (pressure in pressures) {
if (pressure.key == Constants.noReligionName) continue
val correspondingReligion = cityInfo.civInfo.gameInfo.religions[pressure.key]!!
for (pressure in pressures.keys.toList()) { // Copy the keys because we might modify
if (pressure == Constants.noReligionName) continue
val correspondingReligion = cityInfo.civInfo.gameInfo.religions[pressure]!!
if (correspondingReligion.isPantheon()
&& correspondingReligion.foundingCivName != cityInfo.civInfo.civName
) {
pressures.remove(pressure.key)
pressures.remove(pressure)
}
}
updateNumberOfFollowers()

View File

@ -85,11 +85,12 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
private fun addReligionInfo() {
val label = cityInfo.religion.getMajorityReligionName()
?: "None"
val icon = if (label == "None") "Religion" else label
val expanderTab =
ExpanderTab(
title = "Majority Religion: [$label]",
fontSize = 18,
icon = ImageGetter.getCircledReligionIcon(label, 30f),
icon = ImageGetter.getCircledReligionIcon(icon, 30f),
defaultPad = 0f,
persistenceID = "CityStatsTable.Religion",
startsOutOpened = false,