diff --git a/src/Game/Controller/GameController.php b/src/Game/Controller/GameController.php index a285313..0268cef 100644 --- a/src/Game/Controller/GameController.php +++ b/src/Game/Controller/GameController.php @@ -134,6 +134,19 @@ final class GameController extends AbstractController // Lazily pick up readiness changes from other players since our last request $dashboardService->checkAllPlayersReady($session); + if ($session->getStatus() === SessionStatus::CREATED) { + $this->addFlash('info', 'This session is still waiting for more players to join.'); + return $this->redirectToRoute('game_dashboard'); + } + + if ($session->getStatus() === SessionStatus::WON) { + return $this->redirectToRoute('game_won', ['session' => $session->getId()]); + } + + if ($session->getStatus() === SessionStatus::LOST) { + return $this->redirectToRoute('game_lost', ['session' => $session->getId()]); + } + if ($session->getStatus() === SessionStatus::READY) { $isReady = false; if ($player) {