diff options
author | joffrey-bion <joffrey.bion@gmail.com> | 2020-11-25 23:57:16 +0100 |
---|---|---|
committer | joffrey-bion <joffrey.bion@gmail.com> | 2020-11-25 23:57:16 +0100 |
commit | d0a5abc2bd0f86be86b773e3f77712b2602bdc24 (patch) | |
tree | 0ab7bd4f540a4e6d4e090c1c4f48e5331a00f24c /sw-engine/src/main | |
parent | Upgrade dependencies (diff) | |
download | seven-wonders-d0a5abc2bd0f86be86b773e3f77712b2602bdc24.tar.gz seven-wonders-d0a5abc2bd0f86be86b773e3f77712b2602bdc24.tar.bz2 seven-wonders-d0a5abc2bd0f86be86b773e3f77712b2602bdc24.zip |
Fix resource transactions calculations
Resolves:
https://github.com/joffrey-bion/seven-wonders/issues/49
Diffstat (limited to 'sw-engine/src/main')
-rw-r--r-- | sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/BestPriceCalculator.kt | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/BestPriceCalculator.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/BestPriceCalculator.kt index e5f27c05..846e7fd2 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/BestPriceCalculator.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/BestPriceCalculator.kt @@ -17,7 +17,7 @@ private class ResourcePool( private val rules: TradingRules, choices: List<Set<ResourceType>>, ) { - val choices: Set<MutableSet<ResourceType>> = choices.mapTo(HashSet()) { it.toMutableSet() } + val choices: List<MutableSet<ResourceType>> = choices.map { it.toMutableSet() } fun getCost(type: ResourceType): Int = if (provider == null) 0 else rules.getCost(type, provider) } @@ -98,7 +98,7 @@ private class BestPriceCalculator(resourcesToPay: Resources, player: Player) { fun unbuyOne(provider: Provider, type: ResourceType, cost: Int) { pricePaid -= cost - boughtResources.get(provider)!!.remove(type, 1) + boughtResources[provider]!!.remove(type, 1) } private fun computePossibilitiesWhenUsing(type: ResourceType, pool: ResourcePool) { |