From b5f054f0b792dda2def29465df3d36f53fb3fda8 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Mon, 5 Oct 2020 12:11:26 -0600 Subject: [PATCH] remove references for the DB --- src/events/HostGame.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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);