Fixed "other civ doesn't get duration on timed trades" bug
This commit is contained in:
parent
56c547886c
commit
b28a247bd0
2 changed files with 12 additions and 7 deletions
|
@ -10,6 +10,8 @@ By rh-github-2015:
|
|||
|
||||
Unit purchasing limits - by EdinCitaku
|
||||
|
||||
Unit Action buttons stick to the left
|
||||
|
||||
Translation updates
|
||||
|
||||
## 3.6.9
|
||||
|
|
|
@ -5,16 +5,19 @@ import com.unciv.UncivGame
|
|||
import com.unciv.models.metadata.GameSpeed
|
||||
import com.unciv.models.translations.tr
|
||||
|
||||
data class TradeOffer(var name:String, var type: TradeType, var amount:Int=1) {
|
||||
data class TradeOffer(var name:String, var type: TradeType, var amount:Int=1, var duration:Int=0) {
|
||||
|
||||
constructor() : this("", TradeType.Gold) // so that the json deserializer can work
|
||||
var duration = when(type){
|
||||
TradeType.Gold, TradeType.Technology, TradeType.Introduction, TradeType.WarDeclaration, TradeType.City -> 0 /** 0 for offers that are immediate (e.g. gold transfer) */
|
||||
else -> when(UncivGame.Current.gameInfo.gameParameters.gameSpeed){
|
||||
GameSpeed.Quick -> if (name==Constants.peaceTreaty) 10 else 25
|
||||
else -> ((if (name==Constants.peaceTreaty) 10 else 30) * UncivGame.Current.gameInfo.gameParameters.gameSpeed.modifier).toInt()
|
||||
init {
|
||||
// Duration needs to be part of the variables defined at the top, so that it will be copied over with copy()
|
||||
duration = when(type){
|
||||
TradeType.Gold, TradeType.Technology, TradeType.Introduction, TradeType.WarDeclaration, TradeType.City -> 0 /** 0 for offers that are immediate (e.g. gold transfer) */
|
||||
else -> when(UncivGame.Current.gameInfo.gameParameters.gameSpeed){
|
||||
GameSpeed.Quick -> if (name==Constants.peaceTreaty) 10 else 25
|
||||
else -> ((if (name==Constants.peaceTreaty) 10 else 30) * UncivGame.Current.gameInfo.gameParameters.gameSpeed.modifier).toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
constructor() : this("", TradeType.Gold) // so that the json deserializer can work
|
||||
fun equals(offer: TradeOffer): Boolean {
|
||||
return offer.name==name
|
||||
&& offer.type==type
|
||||
|
|
Loading…
Reference in a new issue