From d0a5abc2bd0f86be86b773e3f77712b2602bdc24 Mon Sep 17 00:00:00 2001 From: joffrey-bion Date: Wed, 25 Nov 2020 23:57:16 +0100 Subject: Fix resource transactions calculations Resolves: https://github.com/joffrey-bion/seven-wonders/issues/49 --- .../org/luxons/sevenwonders/engine/resources/BestPriceCalculator.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sw-engine/src/main') 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>, ) { - val choices: Set> = choices.mapTo(HashSet()) { it.toMutableSet() } + val choices: List> = 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) { -- cgit