diff --git a/changelog.md b/changelog.md index fc440a0382..85e2eaa109 100644 --- a/changelog.md +++ b/changelog.md @@ -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 diff --git a/core/src/com/unciv/logic/trade/TradeOffer.kt b/core/src/com/unciv/logic/trade/TradeOffer.kt index bc5265ff42..60e35f068d 100644 --- a/core/src/com/unciv/logic/trade/TradeOffer.kt +++ b/core/src/com/unciv/logic/trade/TradeOffer.kt @@ -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