From 5568cc08c07c772f0f8fa6926c4eb6af02562bc0 Mon Sep 17 00:00:00 2001 From: SomeTroglodyte <63000004+SomeTroglodyte@users.noreply.github.com> Date: Thu, 8 Feb 2024 20:33:38 +0100 Subject: [PATCH] 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 --- .../GlobalPoliticsOverviewTable.kt | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/core/src/com/unciv/ui/screens/overviewscreen/GlobalPoliticsOverviewTable.kt b/core/src/com/unciv/ui/screens/overviewscreen/GlobalPoliticsOverviewTable.kt index d5ab522eeb..0bdba0b6e6 100644 --- a/core/src/com/unciv/ui/screens/overviewscreen/GlobalPoliticsOverviewTable.kt +++ b/core/src/com/unciv/ui/screens/overviewscreen/GlobalPoliticsOverviewTable.kt @@ -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, 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