Non-replacing buildings display uniques nicely in nation picker

This commit is contained in:
Yair Morgenstern
2023-01-05 13:13:52 +02:00
parent 6c708d537f
commit 5941beba26
2 changed files with 4 additions and 3 deletions

View File

@ -62,7 +62,7 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction {
private var replacementTextForUniques = ""
/** Used for AlertType.WonderBuilt, and as sub-text in Nation and Tech descriptions */
fun getShortDescription(): String { // should fit in one line
fun getShortDescription(multiline:Boolean = false): String {
val infoList = mutableListOf<String>()
this.clone().toString().also { if (it.isNotEmpty()) infoList += it }
for ((key, value) in getStatPercentageBonuses(null))
@ -76,7 +76,8 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction {
}
if (cityStrength != 0) infoList += "{City strength} +$cityStrength"
if (cityHealth != 0) infoList += "{City health} +$cityHealth"
return infoList.joinToString("; ") { it.tr() }
val separator = if (multiline) "\n" else "; "
return infoList.joinToString(separator) { it.tr() }
}
/**

View File

@ -210,7 +210,7 @@ class Nation : RulesetObject() {
} else if (building.replaces != null) {
yield(FormattedLine("Replaces [${building.replaces}], which is not found in the ruleset!", indent=1))
} else {
yield(FormattedLine(building.getShortDescription(), indent=1))
yield(FormattedLine(building.getShortDescription(true), indent=1))
}
}
}