diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2018-07-12 02:28:19 +0200 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2018-07-12 02:28:19 +0200 |
commit | d3f59772aafa9dc06a7cae8a16ac4b5093e42527 (patch) | |
tree | 90142a30237a207cd8ce51e2192c56c2256da7e7 /game-engine | |
parent | Game class refactoring (diff) | |
download | seven-wonders-d3f59772aafa9dc06a7cae8a16ac4b5093e42527.tar.gz seven-wonders-d3f59772aafa9dc06a7cae8a16ac4b5093e42527.tar.bz2 seven-wonders-d3f59772aafa9dc06a7cae8a16ac4b5093e42527.zip |
Replace String.format() with template strings
Diffstat (limited to 'game-engine')
-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'") } } |