Removed double trade processing and notifications from Treaties

This commit is contained in:
Oskar Niesen
2023-09-09 14:35:01 -05:00
parent 1e0de36737
commit 371e8e8a62

View File

@ -124,11 +124,15 @@ class TradeLogic(val ourCivilization:Civilization, val otherCivilization: Civili
to.popupAlerts.add(PopupAlert(AlertType.CityTraded, city.id)) to.popupAlerts.add(PopupAlert(AlertType.CityTraded, city.id))
} }
TradeType.Treaty -> { 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.peaceTreaty) to.getDiplomacyManager(from).makePeace()
if (offer.name == Constants.researchAgreement) { if (offer.name == Constants.researchAgreement) {
to.addGold(-offer.amount) to.addGold(-offer.amount)
from.addGold(-offer.amount)
to.getDiplomacyManager(from) to.getDiplomacyManager(from)
.setFlag(DiplomacyFlags.ResearchAgreement, offer.duration) .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) from.getDiplomacyManager(to).signDefensivePact(offer.duration);
} }
@ -155,8 +159,8 @@ class TradeLogic(val ourCivilization:Civilization, val otherCivilization: Civili
for (offer in currentTrade.theirOffers.filter { it.type == TradeType.Treaty }) for (offer in currentTrade.theirOffers.filter { it.type == TradeType.Treaty })
transferTrade(otherCivilization, ourCivilization, offer) transferTrade(otherCivilization, ourCivilization, offer)
for (offer in currentTrade.ourOffers.filter { it.type == TradeType.Treaty }) // for (offer in currentTrade.ourOffers.filter { it.type == TradeType.Treaty })
transferTrade(ourCivilization, otherCivilization, offer) // transferTrade(ourCivilization, otherCivilization, offer)
ourCivilization.cache.updateCivResources() ourCivilization.cache.updateCivResources()
ourCivilization.updateStatsForNextTurn() ourCivilization.updateStatsForNextTurn()