From: Carl Worth Date: Mon, 1 Jun 2020 01:01:00 +0000 (-0700) Subject: Return the actual game object from create_game, not just the ID X-Git-Url: https://git.cworth.org/git?p=empires-server;a=commitdiff_plain;h=493acb2b3b21f592d0ab958ba2875bb412eb8468 Return the actual game object from create_game, not just the ID It was confusing for "create_game" to not return the obvious thing, (the game that it just created). And now that a game has an "id" property, it's easy enough to use that when needed. --- diff --git a/lmno.js b/lmno.js index 5d7d568..9998c73 100644 --- a/lmno.js +++ b/lmno.js @@ -72,7 +72,7 @@ class LMNO { this.games[id] = game; - return id; + return game; } } @@ -108,8 +108,8 @@ function lmno_canonize(id) { app.post('/new/:game_engine', (request, response) => { const game_engine = request.params.game_engine; - const game_id = lmno.create_game(game_engine); - response.send(JSON.stringify(game_id)); + const game = lmno.create_game(game_engine); + response.send(JSON.stringify(game.id)); }); /* Redirect any requests to a game ID at the top-level.