From 8d8074977b81705ae771105da48d7ecc3e046b4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Vigh?= Date: Thu, 6 May 2021 20:25:48 +0200 Subject: [PATCH] fixing comments --- src/Controller/GameFlowController.php | 2 +- src/Repository/PlaceRepository.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Controller/GameFlowController.php b/src/Controller/GameFlowController.php index bb5bffc..eba2a48 100644 --- a/src/Controller/GameFlowController.php +++ b/src/Controller/GameFlowController.php @@ -253,7 +253,7 @@ class GameFlowController private function startNewGame(array &$state, int $mapId): void { $session = $this->request->session(); - $userId = $session->get('userId'); // in case of multiplayer it will be null and handled the same way as for anonymous players + $userId = $session->get('userId'); $places = $this->placeRepository->getRandomNPlaces($mapId, static::NUMBER_OF_ROUNDS, $userId); diff --git a/src/Repository/PlaceRepository.php b/src/Repository/PlaceRepository.php index e9c1238..c621ff1 100644 --- a/src/Repository/PlaceRepository.php +++ b/src/Repository/PlaceRepository.php @@ -31,9 +31,9 @@ class PlaceRepository //TODO: use Map and User instead of id public function getRandomNPlaces(int $mapId, int $n, ?int $userId): array { - if(!isset($userId)) { // anonymous single player or multiplayer game + if(!isset($userId)) { // anonymous single player return $this->getRandomNForMapWithValidPano($mapId, $n); - } else { // authorized user + } else { // authorized user or multiplayer game with selection based on what the host played before $unvisitedPlaces = $this->getRandomUnvisitedNForMapWithValidPano($mapId, $n, $userId); $oldPlaces = $this->getRandomOldNForMapWithValidPano($mapId, $n - count($unvisitedPlaces), $userId); return array_merge($unvisitedPlaces, $oldPlaces);