From bb7dde3b93d1b0fecdffcc4c69a7a96f96d64f5b Mon Sep 17 00:00:00 2001 From: HoeenHero Date: Mon, 26 Aug 2019 15:12:30 -0400 Subject: [PATCH] Make tournaments not break when hotpatched It might be wise to refactor this to not use a standalone tournaments object later. --- server/tournaments/index.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/server/tournaments/index.ts b/server/tournaments/index.ts index dfd9f4e2d4..a37867b0be 100644 --- a/server/tournaments/index.ts +++ b/server/tournaments/index.ts @@ -1144,26 +1144,26 @@ function createTournament( output.errorReply("You cannot have a player cap that is less than 2."); return; } - const tour = room.game = tournaments[room.id] = new Tournament( + const tour = room.game = Tournaments.tournaments[room.id] = new Tournament( room, format, createTournamentGenerator(generator, generatorMod, output)!, playerCap, isRated, name ); return tour; } function deleteTournament(id: string, output: CommandContext) { - const tournament = tournaments[id]; + const tournament = Tournaments.tournaments[id]; if (!tournament) { output.errorReply(`${id} doesn't exist.`); return false; } tournament.forceEnd(); - delete tournaments[id]; + delete Tournaments.tournaments[id]; const room = Rooms.get(id); if (room) delete room.game; return true; } function getTournament(id: string) { - if (tournaments[id]) { - return tournaments[id]; + if (Tournaments.tournaments[id]) { + return Tournaments.tournaments[id]; } } @@ -1616,11 +1616,11 @@ const chatCommands: ChatCommands = { if (cmd === '') { if (!this.runBroadcast()) return; - const update = Object.keys(tournaments).filter(roomid => { - const tournament = tournaments[roomid]; + const update = Object.keys(Tournaments.tournaments).filter(roomid => { + const tournament = Tournaments.tournaments[roomid]; return !tournament.room.isPrivate && !tournament.room.isPersonal && !tournament.room.staffRoom; }).map(roomid => { - const tournament = tournaments[roomid]; + const tournament = Tournaments.tournaments[roomid]; return { room: tournament.room.id, title: tournament.room.title, format: tournament.name, generator: tournament.generator.name, isStarted: tournament.isTournamentStarted,