diff options
-rw-r--r-- | game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Board.kt | 2 | ||||
-rw-r--r-- | game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceType.kt | 6 |
2 files changed, 3 insertions, 5 deletions
diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Board.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Board.kt index 38a80989..34cccc49 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Board.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Board.kt @@ -95,5 +95,5 @@ class Board(val wonder: Wonder, val playerIndex: Int, settings: Settings) { private fun computeGoldPoints(): Int = gold / 3 * pointsPer3Gold internal class InsufficientFundsException(current: Int, required: Int) : - RuntimeException(String.format("Current balance is %d gold, but %d are required", current, required)) + IllegalStateException("Current balance is $current gold, but $required are required") } diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceType.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceType.kt index 67b176df..7e259023 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceType.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceType.kt @@ -20,9 +20,7 @@ enum class ResourceType(val symbol: Char?) { return fromSymbol(symbol[0]) } - fun fromSymbol(symbol: Char?): ResourceType { - return typesPerSymbol[symbol] - ?: throw IllegalArgumentException(String.format("Unknown resource type symbol '%s'", symbol)) - } + fun fromSymbol(symbol: Char?): ResourceType = + typesPerSymbol[symbol] ?: throw IllegalArgumentException("Unknown resource type symbol '$symbol'") } } |