Resolved #2811 - Offering the same resource to 2 civs when you only have 2 left no longer causes 'trade no longer valid' for the second one
This commit is contained in:
parent
19bb1cdb94
commit
ad5cf3a1ec
1 changed files with 7 additions and 1 deletions
|
@ -49,10 +49,16 @@ object NextTurnAutomation{
|
|||
}
|
||||
|
||||
private fun respondToTradeRequests(civInfo: CivilizationInfo) {
|
||||
for(tradeRequest in civInfo.tradeRequests){
|
||||
for(tradeRequest in civInfo.tradeRequests.toList()){
|
||||
val otherCiv = civInfo.gameInfo.getCivilization(tradeRequest.requestingCiv)
|
||||
val tradeLogic = TradeLogic(civInfo, otherCiv)
|
||||
tradeLogic.currentTrade.set(tradeRequest.trade)
|
||||
/** We need to remove this here, so that if the trade is accepted, the updateDetailedCivResources()
|
||||
* in tradeLogic.acceptTrade() will not consider *both* the trade *and the trade offer as decreasing the
|
||||
* amount of available resources, since that will lead to "Our proposed trade is no longer valid" if we try to offer
|
||||
* the same resource to ANOTHER civ in this turn. Complicated!
|
||||
*/
|
||||
civInfo.tradeRequests.remove(tradeRequest)
|
||||
if(TradeEvaluation().isTradeAcceptable(tradeLogic.currentTrade,civInfo,otherCiv)){
|
||||
tradeLogic.acceptTrade()
|
||||
otherCiv.addNotification("[${civInfo.civName}] has accepted your trade request", Color.GOLD)
|
||||
|
|
Loading…
Reference in a new issue