From 2251bf75953ddf4ddd193b112a9ccf7a2d56c294 Mon Sep 17 00:00:00 2001 From: yairm210 Date: Mon, 8 Apr 2024 17:56:41 +0300 Subject: [PATCH] Cannot trade screen for civs you're at war with through notification action --- .../unciv/logic/civilization/NotificationActions.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/logic/civilization/NotificationActions.kt b/core/src/com/unciv/logic/civilization/NotificationActions.kt index 57cc42922c..9bb11b2790 100644 --- a/core/src/com/unciv/logic/civilization/NotificationActions.kt +++ b/core/src/com/unciv/logic/civilization/NotificationActions.kt @@ -83,16 +83,21 @@ class DiplomacyAction( private var showTrade: Boolean = false ) : NotificationAction { override fun execute(worldScreen: WorldScreen) { + val currentCiv = worldScreen.selectedCiv val otherCiv = worldScreen.gameInfo.getCivilization(otherCivName) - if (showTrade && otherCiv == worldScreen.gameInfo.getCurrentPlayerCivilization()) + + if (showTrade && otherCiv == currentCiv) // Because TradeTable will set up otherCiv against that one, // not the one we pass below, and two equal civs will crash - can't look up a DiplomacyManager. return // We should not be able to trade with city-states - if (showTrade && (otherCiv.isCityState() || worldScreen.gameInfo.getCurrentPlayerCivilization().isCityState())) + if (showTrade && (otherCiv.isCityState() || currentCiv.isCityState())) showTrade = false + + if (showTrade && currentCiv.isAtWarWith(otherCiv)) + showTrade = false // Can't trade right now - worldScreen.game.pushScreen(DiplomacyScreen(worldScreen.selectedCiv, otherCiv, showTrade = showTrade)) + worldScreen.game.pushScreen(DiplomacyScreen(currentCiv, otherCiv, showTrade = showTrade)) } }