Trade ending notification (#8925)

* Notification of the end of a trade in 3 and 1 turns

* Notification about the loss of an alliance is not shown if the city state is captured.

* Shortened
This commit is contained in:
Gualdimar
2023-03-16 14:30:12 +02:00
committed by GitHub
parent a4aa5b7b5a
commit 5ee3df96c8
3 changed files with 11 additions and 1 deletions

View File

@ -894,6 +894,8 @@ You and [name] are no longer allies! =
[civName] has denied your trade request =
[tradeOffer] from [otherCivName] has ended =
[tradeOffer] to [otherCivName] has ended =
[tradeOffer] from [otherCivName] will end in [amount] turns =
[tradeOffer] from [otherCivName] will end next turn =
One of our trades with [nation] has ended =
One of our trades with [nation] has been cut short =
[nation] agreed to stop settling cities near us! =

View File

@ -263,7 +263,7 @@ class CityStateFunctions(val civInfo: Civilization) {
}
}
}
if (oldAllyName != null) {
if (oldAllyName != null && civInfo.isAlive()) {
val oldAllyCiv = civInfo.gameInfo.getCivilization(oldAllyName)
val text = "We have lost alliance with [${civInfo.civName}]."
if (capitalLocation != null) oldAllyCiv.addNotification(text, capitalLocation,

View File

@ -573,6 +573,14 @@ class DiplomacyManager() : IsPartOfGameInfoSerialization {
civInfo.cache.updateCivResources()
}
}
for (offer in trade.theirOffers.filter { it.duration <= 3 })
{
if (offer.duration == 3)
civInfo.addNotification("[${offer.name}] from [$otherCivName] will end in [3] turns", NotificationCategory.Trade, otherCivName, NotificationIcon.Trade)
else if (offer.duration == 1)
civInfo.addNotification("[${offer.name}] from [$otherCivName] will end next turn", NotificationCategory.Trade, otherCivName, NotificationIcon.Trade)
}
}
}