summaryrefslogtreecommitdiff
path: root/scripts/gui/lobby.js
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-07-27 00:30:42 -0400
committerKyle Gunger <kgunger12@gmail.com>2022-07-27 00:30:42 -0400
commitd0ec435399ff3308be1b79ad67e37321b9a97b8e (patch)
tree9298f875c7cb6328294427d8e543c9024a08798d /scripts/gui/lobby.js
parenta97fcacb0ce4d2f30fbe989ec1f62f6bd95c7e9a (diff)
[chat] Use an object instead of a list
Diffstat (limited to 'scripts/gui/lobby.js')
-rw-r--r--scripts/gui/lobby.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/gui/lobby.js b/scripts/gui/lobby.js
index 6517592..c625420 100644
--- a/scripts/gui/lobby.js
+++ b/scripts/gui/lobby.js
@@ -158,7 +158,7 @@ class Lobby {
// { data.name string } name of the game the server runs
// { data.games array } array of public games the server is running
// { data.games[n].name } room name
- // { data.games[n].packs } list of the pack names used by this game
+ // { data.games[n].packs } number of extra packs used by this game
// { data.games[n].id } room identifier (uuid)
// { data.games[n].max } max players in room
gameList (data) {
@@ -167,8 +167,12 @@ class Lobby {
}
for (let i of data.games) {
- let g = new Game(i, this.e.games);
- this.games.push(g);
+ if (this.games[i.id] == null) {
+ let g = new Game(i, this.e.games);
+ this.games[i.id] = g;
+ } else {
+ console.log(`Game with duplicate ID ${i.id} was discarded.`);
+ }
}
this.e.stats.game.innerText = data.name;