summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorJoffrey BION <joffrey.bion@gmail.com>2018-07-16 02:19:16 +0200
committerJoffrey BION <joffrey.bion@gmail.com>2018-07-16 02:19:22 +0200
commitd1b3c9c9ff575fe0af010e7c335945f69232a2db (patch)
tree866ad9f462b5249550301653a1a682a5356d41a6 /backend
parentRework resources representations (diff)
downloadseven-wonders-d1b3c9c9ff575fe0af010e7c335945f69232a2db.tar.gz
seven-wonders-d1b3c9c9ff575fe0af010e7c335945f69232a2db.tar.bz2
seven-wonders-d1b3c9c9ff575fe0af010e7c335945f69232a2db.zip
Make GameDefinitionLoader a singleton object
Diffstat (limited to 'backend')
-rw-r--r--backend/src/main/kotlin/org/luxons/sevenwonders/repositories/LobbyRepository.kt4
-rw-r--r--backend/src/test/kotlin/org/luxons/sevenwonders/lobby/LobbyTest.kt2
2 files changed, 2 insertions, 4 deletions
diff --git a/backend/src/main/kotlin/org/luxons/sevenwonders/repositories/LobbyRepository.kt b/backend/src/main/kotlin/org/luxons/sevenwonders/repositories/LobbyRepository.kt
index 261f723c..7ca78233 100644
--- a/backend/src/main/kotlin/org/luxons/sevenwonders/repositories/LobbyRepository.kt
+++ b/backend/src/main/kotlin/org/luxons/sevenwonders/repositories/LobbyRepository.kt
@@ -10,8 +10,6 @@ import java.util.HashMap
@Repository
class LobbyRepository @Autowired constructor() {
- private val gameDefinitionLoader: GameDefinitionLoader = GameDefinitionLoader()
-
private val lobbies = HashMap<Long, Lobby>()
private var lastGameId: Long = 0
@@ -20,7 +18,7 @@ class LobbyRepository @Autowired constructor() {
fun create(gameName: String, owner: Player): Lobby {
val id = lastGameId++
- val lobby = Lobby(id, gameName, owner, gameDefinitionLoader.gameDefinition)
+ val lobby = Lobby(id, gameName, owner, GameDefinitionLoader.gameDefinition)
lobbies[id] = lobby
return lobby
}
diff --git a/backend/src/test/kotlin/org/luxons/sevenwonders/lobby/LobbyTest.kt b/backend/src/test/kotlin/org/luxons/sevenwonders/lobby/LobbyTest.kt
index 3abdde3b..84cef934 100644
--- a/backend/src/test/kotlin/org/luxons/sevenwonders/lobby/LobbyTest.kt
+++ b/backend/src/test/kotlin/org/luxons/sevenwonders/lobby/LobbyTest.kt
@@ -223,7 +223,7 @@ class LobbyTest {
@JvmStatic
@BeforeClass
fun loadDefinition() {
- gameDefinition = GameDefinitionLoader().gameDefinition
+ gameDefinition = GameDefinitionLoader.gameDefinition
}
}
}
bgstack15