Fixed politics tab not showing defensive pacts (#10079)

* Override DoF displayed on Politics table with defensive pact when applicable and added CYAN color to table and diagram.

* City-state alliances now show as CYAN in the politics table
This commit is contained in:
Oskar Niesen 2023-09-11 01:28:52 -05:00 committed by GitHub
parent ee81b3e84e
commit c3484381c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -1402,6 +1402,7 @@ Politics =
Show global politics =
Show diagram =
At war with [enemy] =
Defensive pact with [civName] =
Friends with [civName] =
an unknown civilization =
[numberOfTurns] Turns Left =

View File

@ -187,9 +187,14 @@ class GlobalPoliticsOverviewTable (
}
politicsTable.row()
// declaration of friendships
// defensive pacts and declaration of friendships
for (otherCiv in civ.getKnownCivs()) {
if (civ.diplomacy[otherCiv.civName]?.hasFlag(DiplomacyFlags.DeclarationOfFriendship) == true) {
if (civ.diplomacy[otherCiv.civName]?.hasFlag(DiplomacyFlags.DefensivePact) == true) {
val friendText = ColorMarkupLabel("Defensive pact with [${getCivName(otherCiv)}]", Color.CYAN)
val turnsLeftText = " (${civ.diplomacy[otherCiv.civName]?.getFlag(DiplomacyFlags.DefensivePact)} ${Fonts.turn})".toLabel()
politicsTable.add(friendText)
politicsTable.add(turnsLeftText).row()
} else if (civ.diplomacy[otherCiv.civName]?.hasFlag(DiplomacyFlags.DeclarationOfFriendship) == true) {
val friendText = ColorMarkupLabel("Friends with [${getCivName(otherCiv)}]", Color.GREEN)
val turnsLeftText = " (${civ.diplomacy[otherCiv.civName]?.getFlag(DiplomacyFlags.DeclarationOfFriendship)} ${Fonts.turn})".toLabel()
politicsTable.add(friendText)
@ -212,7 +217,7 @@ class GlobalPoliticsOverviewTable (
//allied CS
for (cityState in gameInfo.getAliveCityStates()) {
if (cityState.diplomacy[civ.civName]?.isRelationshipLevelEQ(RelationshipLevel.Ally) == true) {
val alliedText = ColorMarkupLabel("Allied with [${getCivName(cityState)}]", Color.GREEN)
val alliedText = ColorMarkupLabel("Allied with [${getCivName(cityState)}]", Color.CYAN)
politicsTable.add(alliedText).row()
}
}
@ -435,6 +440,10 @@ class GlobalPoliticsOverviewTable (
width = 2f)
statusLine.color = if (diplomacy.diplomaticStatus == DiplomaticStatus.War) Color.RED
else if (diplomacy.diplomaticStatus == DiplomaticStatus.DefensivePact
|| (diplomacy.civInfo.isCityState() && diplomacy.civInfo.getAllyCiv() == diplomacy.otherCivName)
|| (diplomacy.otherCiv().isCityState() && diplomacy.otherCiv().getAllyCiv() == diplomacy.civInfo.civName)
) Color.CYAN
else diplomacy.relationshipLevel().color
if (!civLines.containsKey(civ.civName)) civLines[civ.civName] = mutableSetOf()