summaryrefslogtreecommitdiff
path: root/sw-engine/src/main
diff options
context:
space:
mode:
authorjoffrey-bion <joffrey.bion@gmail.com>2020-11-25 23:57:16 +0100
committerjoffrey-bion <joffrey.bion@gmail.com>2020-11-25 23:57:16 +0100
commitd0a5abc2bd0f86be86b773e3f77712b2602bdc24 (patch)
tree0ab7bd4f540a4e6d4e090c1c4f48e5331a00f24c /sw-engine/src/main
parentUpgrade dependencies (diff)
downloadseven-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.kt4
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) {
bgstack15