mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-24 10:01:39 +07:00
Cannot trade screen for civs you're at war with through notification action
This commit is contained in:
parent
7dfa6682e0
commit
2251bf7595
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user