diff --git a/src/events/HostGame.ts b/src/events/HostGame.ts index 78d1193..3d6cd17 100644 --- a/src/events/HostGame.ts +++ b/src/events/HostGame.ts @@ -11,7 +11,6 @@ Client Side: After the host receives the `HostInformation` event, the Query String parameters should be updated with the Websocket URI and the game code so that the host is able to just send that to the other players */ -import * as db from '../utils/db'; import { Socket } from 'socket.io'; import { Game } from '../utils/Game'; import { active_games, log } from '../main'; @@ -22,7 +21,7 @@ export const HostGame = (socket: Socket, data: HostGame) => { // Get a game code that is not in use to prevent join conflicts let game_code = generate_game_code(); - while (db.exists(game_code)) { + while (Object.keys(active_games).includes(game_code)) { game_code = generate_game_code(); } @@ -35,8 +34,7 @@ export const HostGame = (socket: Socket, data: HostGame) => { // Respond to client socket.emit(`HostInformation`, { success: true, - game_code: game_code, - players: [data.username] + game_code: game_code }); } catch (err) { log.error(err);