Refactor loop
authorTheSaminator <TheSaminator@users.noreply.github.com>
Thu, 2 Jun 2022 16:13:56 +0000 (12:13 -0400)
committerTheSaminator <TheSaminator@users.noreply.github.com>
Thu, 2 Jun 2022 16:13:56 +0000 (12:13 -0400)
src/jsMain/kotlin/starshipfights/game/client_game.kt

index 23b378c6b81389ffc783818141cef08d610a58a5..6448316d0b71908bbb7302055aad9118abc7da6a 100644 (file)
@@ -127,12 +127,10 @@ private suspend fun GameNetworkInteraction.execute(token: String): Pair<LocalSid
                                Popup.GameOver(LocalSide.GREEN, "Unfortunately, your opponent never entered the battle.", gameState.value).display()
                        
                        val sendActionsJob = launch {
-                               while (true) {
-                                       val action = playerActions.receive()
+                               for (action in playerActions)
                                        launch {
                                                sendObject(PlayerAction.serializer(), action)
                                        }
-                               }
                        }
                        
                        while (true) {