Tweak Overview-Politics-Diagram for a defeated player (#11094)

* Adapt Overview Politics diagram view to show a defeated player a little more intuitively

* Fix lines to defeated civ - each is drawn twice, one for each direction

* Defeated civ has no relations on the table view as well
This commit is contained in:
SomeTroglodyte
2024-02-08 20:33:38 +01:00
committed by GitHub
parent 1ad8c69e60
commit 5568cc08c0

View File

@ -206,6 +206,11 @@ class GlobalPoliticsOverviewTable(
if (!viewingPlayer.knows(civ) && civ.civName != viewingPlayer.civName)
return politicsTable
if (civ.isDefeated()) {
politicsTable.add("{Defeated} ${Fonts.death}".toLabel())
return politicsTable
}
// wars
for (otherCiv in civ.getKnownCivs()) {
if (civ.isAtWarWith(otherCiv)) {
@ -357,7 +362,9 @@ class GlobalPoliticsOverviewTable(
add("[$relevantCivsCount] Civilizations in the game".toLabel()).colspan(columns).row()
add("Our Civilization:".toLabel()).colspan(columns).left().padLeft(10f).padTop(10f).row()
add(getCivMiniTable(viewingPlayer)).left()
add(viewingPlayer.calculateTotalScore().toInt().toLabel()).left().row()
val scoreText = if (viewingPlayer.isDefeated()) Fonts.death.toString()
else viewingPlayer.calculateTotalScore().toInt().toString()
add(scoreText.toLabel()).left().row()
val turnsTillNextDiplomaticVote = viewingPlayer.getTurnsTillNextDiplomaticVote() ?: return
add("Turns until the next\ndiplomacy victory vote: [$turnsTillNextDiplomaticVote]".toLabel()).colspan(columns).row()
}
@ -394,7 +401,10 @@ class GlobalPoliticsOverviewTable(
}
}
/** This is the 'spider net'-like polygon showing one line per civ-civ relation */
/** This is the 'spider net'-like polygon showing one line per civ-civ relation
* @param undefeatedCivs Civs to display - note the viewing player is always included, so it's possible the name is off and there's a dead civ included.
* @param freeSize Width and height this [Group] sizes itself to
*/
private class DiplomacyGroup(
undefeatedCivs: Sequence<Civilization>,
freeSize: Float
@ -466,8 +476,10 @@ class GlobalPoliticsOverviewTable(
}
for (civ in undefeatedCivs) {
if (civ.isDefeated()) continue // if you're dead, icon but no lines (One more turn mode after losing)
for (diplomacy in civ.diplomacy.values) {
if (diplomacy.otherCiv() !in undefeatedCivs) continue
val otherCiv = diplomacy.otherCiv()
if (otherCiv !in undefeatedCivs || otherCiv.isDefeated()) continue
val civGroup = civGroups[civ.civName]!!
val otherCivGroup = civGroups[diplomacy.otherCivName]!!
@ -482,7 +494,7 @@ class GlobalPoliticsOverviewTable(
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)
|| (otherCiv.isCityState() && otherCiv.getAllyCiv() == diplomacy.civInfo.civName)
) Color.CYAN
else diplomacy.relationshipLevel().color