From 6afecee45d8e46b695f7f22894fef3effc15a2b7 Mon Sep 17 00:00:00 2001 From: joffrey-bion Date: Sat, 13 Feb 2021 16:45:33 +0100 Subject: Rename some client functions --- .../kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt | 6 +++--- .../org/luxons/sevenwonders/client/SevenWondersClient.kt | 6 +++--- .../org/luxons/sevenwonders/server/SevenWondersTest.kt | 14 +++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt b/sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt index 611c6369..6a4a5bf6 100644 --- a/sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt +++ b/sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt @@ -52,9 +52,9 @@ class SevenWondersBot( "Custom wonders don't match the number of players in the game" } - val lobby = session.createGameAndWaitLobby(gameName) + val lobby = session.createGameAndAwaitLobby(gameName) otherBots.forEach { - it.session.joinGameAndWaitLobby(lobby.id) + it.session.joinGameAndAwaitLobby(lobby.id) } customWonders?.let { session.reassignWonders(it) } @@ -73,7 +73,7 @@ class SevenWondersBot( } suspend fun joinAndAutoPlay(gameId: Long): PlayerTurnInfo { - val firstTurn = session.joinGameAndWaitFirstTurn(gameId) + val firstTurn = session.joinGameAndAwaitFirstTurn(gameId) return autoPlayUntilEnd(firstTurn) } diff --git a/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt b/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt index bf5778ad..3a3cb989 100644 --- a/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt +++ b/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt @@ -149,12 +149,12 @@ class SevenWondersSession(private val stompSession: StompSessionWithKxSerializat } } -suspend fun SevenWondersSession.createGameAndWaitLobby(gameName: String): LobbyDTO = doAndWaitForEvent( +suspend fun SevenWondersSession.createGameAndAwaitLobby(gameName: String): LobbyDTO = doAndWaitForEvent( send = { createGame(gameName) }, subscribe = { watchLobbyJoined() }, ) -suspend fun SevenWondersSession.joinGameAndWaitLobby(gameId: Long): LobbyDTO = doAndWaitForEvent( +suspend fun SevenWondersSession.joinGameAndAwaitLobby(gameId: Long): LobbyDTO = doAndWaitForEvent( send = { joinGame(gameId) }, subscribe = { watchLobbyJoined() }, ) @@ -164,7 +164,7 @@ suspend fun SevenWondersSession.startGameAndAwaitFirstTurn(): PlayerTurnInfo = d subscribe = { watchGameStarted() }, ) -suspend fun SevenWondersSession.joinGameAndWaitFirstTurn(gameId: Long): PlayerTurnInfo = doAndWaitForEvent( +suspend fun SevenWondersSession.joinGameAndAwaitFirstTurn(gameId: Long): PlayerTurnInfo = doAndWaitForEvent( send = { joinGame(gameId) }, subscribe = { watchGameStarted() }, ) diff --git a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/SevenWondersTest.kt b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/SevenWondersTest.kt index 51daf0c8..4d76d7b8 100644 --- a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/SevenWondersTest.kt +++ b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/SevenWondersTest.kt @@ -8,8 +8,8 @@ import kotlinx.coroutines.withTimeoutOrNull import org.junit.runner.RunWith import org.luxons.sevenwonders.client.SevenWondersClient import org.luxons.sevenwonders.client.SevenWondersSession -import org.luxons.sevenwonders.client.createGameAndWaitLobby -import org.luxons.sevenwonders.client.joinGameAndWaitLobby +import org.luxons.sevenwonders.client.createGameAndAwaitLobby +import org.luxons.sevenwonders.client.joinGameAndAwaitLobby import org.luxons.sevenwonders.model.Action import org.luxons.sevenwonders.model.api.GameListEvent import org.luxons.sevenwonders.model.api.LobbyDTO @@ -61,8 +61,8 @@ class SevenWondersTest { val lobby = ownerSession.createGameWithLegacySettingsAndWaitLobby(gameName) - session1.joinGameAndWaitLobby(lobby.id) - session2.joinGameAndWaitLobby(lobby.id) + session1.joinGameAndAwaitLobby(lobby.id) + session2.joinGameAndAwaitLobby(lobby.id) val outsiderSession = newPlayer("Outsider") val gameStartedEvents = outsiderSession.watchGameStarted() @@ -116,12 +116,12 @@ class SevenWondersTest { val lobby = session1.createGameWithLegacySettingsAndWaitLobby("Test Game") val startEvents2 = session2.watchGameStarted() - session2.joinGameAndWaitLobby(lobby.id) + session2.joinGameAndAwaitLobby(lobby.id) // player 3 connects after game creation (on purpose) val session3 = newPlayer("Player3") val startEvents3 = session3.watchGameStarted() - session3.joinGameAndWaitLobby(lobby.id) + session3.joinGameAndAwaitLobby(lobby.id) session1.startGame() @@ -146,7 +146,7 @@ class SevenWondersTest { } private suspend fun SevenWondersSession.createGameWithLegacySettingsAndWaitLobby(gameName: String): LobbyDTO { - val lobby = createGameAndWaitLobby(gameName) + val lobby = createGameAndAwaitLobby(gameName) updateSettings(lobby.settings.copy(askForReadiness = true)) return lobby } -- cgit