diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2018-07-16 02:19:16 +0200 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2018-07-16 02:19:22 +0200 |
commit | d1b3c9c9ff575fe0af010e7c335945f69232a2db (patch) | |
tree | 866ad9f462b5249550301653a1a682a5356d41a6 /backend/src | |
parent | Rework resources representations (diff) | |
download | seven-wonders-d1b3c9c9ff575fe0af010e7c335945f69232a2db.tar.gz seven-wonders-d1b3c9c9ff575fe0af010e7c335945f69232a2db.tar.bz2 seven-wonders-d1b3c9c9ff575fe0af010e7c335945f69232a2db.zip |
Make GameDefinitionLoader a singleton object
Diffstat (limited to 'backend/src')
-rw-r--r-- | backend/src/main/kotlin/org/luxons/sevenwonders/repositories/LobbyRepository.kt | 4 | ||||
-rw-r--r-- | backend/src/test/kotlin/org/luxons/sevenwonders/lobby/LobbyTest.kt | 2 |
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 } } } |