mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-26 05:14:32 -04:00
Removed double notifications and processing of treaties when traded (#10101)
* Removed double notifications and processing of treaties when traded * Added comment to only processing one side of the trade
This commit is contained in:
parent
8e3ebc7724
commit
16d716d794
@ -124,13 +124,17 @@ class TradeLogic(val ourCivilization:Civilization, val otherCivilization: Civili
|
||||
to.popupAlerts.add(PopupAlert(AlertType.CityTraded, city.id))
|
||||
}
|
||||
TradeType.Treaty -> {
|
||||
// Note: Treaties are not transfered from both sides due to notifications and double signing
|
||||
if (offer.name == Constants.peaceTreaty) to.getDiplomacyManager(from).makePeace()
|
||||
if (offer.name == Constants.researchAgreement) {
|
||||
to.addGold(-offer.amount)
|
||||
from.addGold(-offer.amount)
|
||||
to.getDiplomacyManager(from)
|
||||
.setFlag(DiplomacyFlags.ResearchAgreement, offer.duration)
|
||||
from.getDiplomacyManager(to)
|
||||
.setFlag(DiplomacyFlags.ResearchAgreement, offer.duration)
|
||||
}
|
||||
if (offer.name == Constants.defensivePact) from.getDiplomacyManager(to).signDefensivePact(offer.duration);
|
||||
if (offer.name == Constants.defensivePact) to.getDiplomacyManager(from).signDefensivePact(offer.duration);
|
||||
}
|
||||
TradeType.Introduction -> to.diplomacyFunctions.makeCivilizationsMeet(to.gameInfo.getCivilization(offer.name))
|
||||
TradeType.WarDeclaration -> {
|
||||
@ -153,10 +157,9 @@ class TradeLogic(val ourCivilization:Civilization, val otherCivilization: Civili
|
||||
for (offer in currentTrade.ourOffers.filterNot { it.type == TradeType.Treaty })
|
||||
transferTrade(ourCivilization, otherCivilization, offer)
|
||||
|
||||
// Transfter of treaties should only be done from one side to avoid double signing and notifying
|
||||
for (offer in currentTrade.theirOffers.filter { it.type == TradeType.Treaty })
|
||||
transferTrade(otherCivilization, ourCivilization, offer)
|
||||
for (offer in currentTrade.ourOffers.filter { it.type == TradeType.Treaty })
|
||||
transferTrade(ourCivilization, otherCivilization, offer)
|
||||
|
||||
ourCivilization.cache.updateCivResources()
|
||||
ourCivilization.updateStatsForNextTurn()
|
||||
|
Loading…
x
Reference in New Issue
Block a user