mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-09 23:39:40 +07:00
Fixed trading with city-state through notifications (#10645)
* NotificationActions DiplomacyAction no longer allows trading with city-states * Added a comment
This commit is contained in:
@ -80,7 +80,7 @@ class CityAction(private val city: Vector2 = Vector2.Zero) : NotificationAction
|
|||||||
/** enter diplomacy screen */
|
/** enter diplomacy screen */
|
||||||
class DiplomacyAction(
|
class DiplomacyAction(
|
||||||
private val otherCivName: String = "",
|
private val otherCivName: String = "",
|
||||||
private val showTrade: Boolean = false
|
private var showTrade: Boolean = false
|
||||||
) : NotificationAction {
|
) : NotificationAction {
|
||||||
override fun execute(worldScreen: WorldScreen) {
|
override fun execute(worldScreen: WorldScreen) {
|
||||||
val otherCiv = worldScreen.gameInfo.getCivilization(otherCivName)
|
val otherCiv = worldScreen.gameInfo.getCivilization(otherCivName)
|
||||||
@ -88,6 +88,10 @@ class DiplomacyAction(
|
|||||||
// Because TradeTable will set up otherCiv against that one,
|
// 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.
|
// not the one we pass below, and two equal civs will crash - can't look up a DiplomacyManager.
|
||||||
return
|
return
|
||||||
|
// We should not be able to trade with city-states
|
||||||
|
if (showTrade && (otherCiv.isCityState() || worldScreen.gameInfo.getCurrentPlayerCivilization().isCityState()))
|
||||||
|
showTrade = false
|
||||||
|
|
||||||
worldScreen.game.pushScreen(DiplomacyScreen(worldScreen.selectedCiv, otherCiv, showTrade = showTrade))
|
worldScreen.game.pushScreen(DiplomacyScreen(worldScreen.selectedCiv, otherCiv, showTrade = showTrade))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user