mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
Prevent offering zero gold. (#9119)
This happened to me in a game, unfortunately I don't have the save since it's one round ago in a multiplayer game, but I'm pretty sure this is the part of the code causing the problem.
This commit is contained in:
parent
735a0f6f40
commit
0e87be8487
@ -235,7 +235,16 @@ object NextTurnAutomation {
|
|||||||
val valueOfOne = evaluation.evaluateSellCost(TradeOffer(ourGold.name, ourGold.type, 1, ourGold.duration), civInfo, otherCiv)
|
val valueOfOne = evaluation.evaluateSellCost(TradeOffer(ourGold.name, ourGold.type, 1, ourGold.duration), civInfo, otherCiv)
|
||||||
val amountToGive = min(deltaInOurFavor / valueOfOne, ourGold.amount)
|
val amountToGive = min(deltaInOurFavor / valueOfOne, ourGold.amount)
|
||||||
deltaInOurFavor -= amountToGive * valueOfOne
|
deltaInOurFavor -= amountToGive * valueOfOne
|
||||||
counterofferGifts.add(TradeOffer(ourGold.name, ourGold.type, amountToGive, ourGold.duration))
|
if (amountToGive > 0) {
|
||||||
|
counterofferGifts.add(
|
||||||
|
TradeOffer(
|
||||||
|
ourGold.name,
|
||||||
|
ourGold.type,
|
||||||
|
amountToGive,
|
||||||
|
ourGold.duration
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user