diff options
Diffstat (limited to 'game-engine/src/main')
-rw-r--r-- | game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/PlayerMove.kt | 5 | ||||
-rw-r--r-- | game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceTransactions.kt | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/PlayerMove.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/PlayerMove.kt index 95e6b13c..22cc36f0 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/PlayerMove.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/PlayerMove.kt @@ -1,10 +1,11 @@ package org.luxons.sevenwonders.game.api import org.luxons.sevenwonders.game.moves.MoveType -import org.luxons.sevenwonders.game.resources.ResourceTransaction +import org.luxons.sevenwonders.game.resources.ResourceTransactions +import org.luxons.sevenwonders.game.resources.noTransactions data class PlayerMove( val type: MoveType, val cardName: String, - val transactions: Collection<ResourceTransaction> = emptyList() + val transactions: ResourceTransactions = noTransactions() ) diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceTransactions.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceTransactions.kt index c7ab3636..d45d0ce7 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceTransactions.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceTransactions.kt @@ -4,10 +4,10 @@ import org.luxons.sevenwonders.game.Player typealias ResourceTransactions = Collection<ResourceTransaction> -fun noTransactions(): ResourceTransactions = emptyList() +fun noTransactions(): ResourceTransactions = emptySet() -fun Map<Provider, Resources>.toTransactions() = - filter { (_, res) -> !res.isEmpty() }.map { (p, res) -> ResourceTransaction(p, res) } +fun Map<Provider, Resources>.toTransactions(): ResourceTransactions = + filter { (_, res) -> !res.isEmpty() }.map { (p, res) -> ResourceTransaction(p, res) }.toSet() fun ResourceTransactions.asResources(): Resources = map { it.resources }.merge() |