From edac7bcd0455c4a348bbf3be73fcadfb9b38a789 Mon Sep 17 00:00:00 2001 From: WhoIsJohannes <126110113+WhoIsJohannes@users.noreply.github.com> Date: Sun, 11 Jun 2023 11:41:40 +0200 Subject: [PATCH] Show line color in more cases (#9550) --- core/src/com/unciv/ui/components/LineChart.kt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/core/src/com/unciv/ui/components/LineChart.kt b/core/src/com/unciv/ui/components/LineChart.kt index 7707a986ea..522145b843 100644 --- a/core/src/com/unciv/ui/components/LineChart.kt +++ b/core/src/com/unciv/ui/components/LineChart.kt @@ -203,8 +203,7 @@ class LineChart( val a = simplifiedScaledPoints[i - 1] val b = simplifiedScaledPoints[i] val selectedCivBackgroundColor = - if (viewingCiv == civ || viewingCiv.knows(civ)) civ.nation.getInnerColor() - else Color.LIGHT_GRAY + if (useActualColor(civ)) civ.nation.getInnerColor() else Color.LIGHT_GRAY drawLine( batch, a.x, a.y, b.x, b.y, selectedCivBackgroundColor, chartLineWidth * 3 @@ -214,9 +213,7 @@ class LineChart( for (i in 1 until simplifiedScaledPoints.size) { val a = simplifiedScaledPoints[i - 1] val b = simplifiedScaledPoints[i] - val civLineColor = - if (viewingCiv == civ || viewingCiv.knows(civ)) civ.nation.getOuterColor() - else Color.DARK_GRAY + val civLineColor = if (useActualColor(civ)) civ.nation.getOuterColor() else Color.DARK_GRAY drawLine(batch, a.x, a.y, b.x, b.y, civLineColor, chartLineWidth) // Draw the selected Civ icon on its last datapoint @@ -244,6 +241,15 @@ class LineChart( batch.transformMatrix = oldTransformMatrix } + private fun useActualColor(civ: Civilization) : Boolean { + return viewingCiv.isSpectator() || + viewingCiv.isDefeated() || + viewingCiv.victoryManager.hasWon() || + viewingCiv == civ || + viewingCiv.knows(civ) || + civ.isDefeated() + } + private fun getLastTurnDataPoints(): MutableMap> { val lastDataPoints = mutableMapOf>() for (dataPoint in dataPoints) {