From 022950ff4989d6394d193a23de8c91ee4e17fc4d Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Thu, 11 Aug 2022 20:42:10 -0400 Subject: Fix game count --- scripts/gui/lobby.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/gui/lobby.js b/scripts/gui/lobby.js index 64af615..a32c47f 100644 --- a/scripts/gui/lobby.js +++ b/scripts/gui/lobby.js @@ -142,6 +142,7 @@ class Lobby { this.init = false; this.online = []; this.games = {}; + this.gameCt = 0; this.packs = []; } @@ -162,6 +163,7 @@ class Lobby { for (let i of data.games) { if(typeof i != "object") continue; + this.gameCt++; if (this.games[i.id] == null) { let g = new Game(i, this.e.games); @@ -173,7 +175,7 @@ class Lobby { this.e.stats.game.innerText = data.game; this.e.stats.packs.innerText = data.packs; - this.e.stats.pubgame.innerText = this.games.length(); + this.e.stats.pubgame.innerText = this.gameCt; } // Set the initial player list. @@ -197,6 +199,8 @@ class Lobby { if(this.games[data.id] == null) { let g = new Game(data, this.e.games); this.games[data.id] = g; + this.gameCt++; + this.e.stats.pubgame.innerText = this.gameCt; } } @@ -239,5 +243,6 @@ class Lobby { this.setState("Connecting", "loading", this.e.addr.innerText); this.init = false; + this.gameCt = 0; } } -- cgit v1.2.3