From: Carl Worth Date: Mon, 1 Jun 2020 00:49:47 +0000 (-0700) Subject: LMNO: Simplify storage of the games array by not storing ID next to game X-Git-Url: https://git.cworth.org/git?p=empires-server;a=commitdiff_plain;h=2fb7ba00b458f94dff3e924b245c8f02dc20525a LMNO: Simplify storage of the games array by not storing ID next to game In the previous commit, we ensured that a game object always knows its own ID, so it's unnecessary to store it alongside. Delete this field from this anonymous object and change all references to instead access game.id. --- diff --git a/lmno.js b/lmno.js index 0fd491a..5f5b2c7 100644 --- a/lmno.js +++ b/lmno.js @@ -71,7 +71,6 @@ class LMNO { const game = new engine.Game(id); this.games[id] = { - id: id, game: game }; @@ -136,7 +135,7 @@ app.get('/[a-zA-Z0-9]{4}', (request, response) => { response.sendStatus(404); return; } - response.redirect(301, `/${game.game.meta.identifier}/${game.id}/`); + response.redirect(301, `/${game.game.meta.identifier}/${game.game.id}/`); }); /* LMNO middleware to lookup the game. */ diff --git a/templates/admin.html b/templates/admin.html index 051d485..4db60ce 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -12,7 +12,7 @@