mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-24 22:59:34 +07:00
Resolved #11478 - Made diplomatic modifiers table backwards-compatible
This commit is contained in:
@ -102,8 +102,12 @@ enum class DiplomaticModifiers(val text: String) {
|
||||
GaveUsUnits("You gave us units!"),
|
||||
GaveUsGifts("We appreciate your gifts"),
|
||||
ReturnedCapturedUnits("You returned captured units to us"),
|
||||
BelieveSameReligion("We believe in the same religion"),
|
||||
BelieveSameReligion("We believe in the same religion");
|
||||
|
||||
companion object{
|
||||
private val valuesAsMap = DiplomaticModifiers.values().associateBy { it.name }
|
||||
fun safeValueOf(name: String) = valuesAsMap[name]
|
||||
}
|
||||
}
|
||||
|
||||
class DiplomacyManager() : IsPartOfGameInfoSerialization {
|
||||
@ -113,7 +117,6 @@ class DiplomacyManager() : IsPartOfGameInfoSerialization {
|
||||
const val MINIMUM_INFLUENCE = -60f
|
||||
}
|
||||
|
||||
@Suppress("JoinDeclarationAndAssignment") // incorrect warning - constructor would need to be higher in scope
|
||||
@Transient
|
||||
lateinit var civInfo: Civilization
|
||||
|
||||
|
@ -199,7 +199,9 @@ class MajorCivDiplomacyTable(private val diplomacyScreen: DiplomacyScreen) {
|
||||
&& otherCivDiplomacyManager.hasModifier(DiplomaticModifiers.DestroyedProtectedMinor))
|
||||
continue
|
||||
|
||||
var text = DiplomaticModifiers.valueOf(modifier.key).text.tr() + " "
|
||||
val diplomaticModifier = DiplomaticModifiers.safeValueOf(modifier.key)
|
||||
?: continue // This modifier is from the future, you cannot understand it yet
|
||||
var text = diplomaticModifier.text.tr() + " "
|
||||
if (modifier.value > 0) text += "+"
|
||||
text += modifier.value.roundToInt()
|
||||
val color = if (modifier.value < 0) Color.RED else Color.GREEN
|
||||
|
Reference in New Issue
Block a user