From 383b23d98fa3eafe82b2dd63eebbfe60aeaafeef Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 3 Dec 2021 01:21:10 +0100 Subject: Fix passing game options to setup function. --- server.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index 41390e5..a8682cd 100644 --- a/server.js +++ b/server.js @@ -1326,9 +1326,10 @@ app.get('/start/:game_id', must_be_logged_in, function (req, res) { players = SQL_SELECT_PLAYERS.all(game_id); update_join_clients_players(game_id); } + let options = game.options ? JSON.parse(game.options) : {}; let seed = random_seed(); - let state = RULES[game.title_id].setup(seed, game.scenario, game.options, players); - put_replay(game_id, null, 'setup', [seed, game.scenario, game.options, players]); + let state = RULES[game.title_id].setup(seed, game.scenario, options, players); + put_replay(game_id, null, 'setup', [seed, game.scenario, options, players]); SQL_UPDATE_GAME_RESULT.run(1, null, game_id); SQL_UPDATE_GAME_STATE.run(game_id, JSON.stringify(state), state.active); if (is_solo(players)) @@ -1739,7 +1740,7 @@ io.on('connection', (socket) => { socket.on('restart', (scenario) => { try { let seed = random_seed(); - let state = socket.rules.setup(seed, scenario, players); + let state = socket.rules.setup(seed, scenario, {}, players); put_replay(socket.game_id, null, 'setup', [seed, scenario, null, players]); for (let other of clients[socket.game_id]) { other.log_length = 0; -- cgit v1.2.3