diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-12-03 01:21:10 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2021-12-03 01:21:25 +0100 |
commit | 383b23d98fa3eafe82b2dd63eebbfe60aeaafeef (patch) | |
tree | 1bbb62ca948a3d355eab39d159961d5d662aa0bb /server.js | |
parent | c31a0939759c5518dd3dfa10c41a14ee0eb534eb (diff) | |
download | server-383b23d98fa3eafe82b2dd63eebbfe60aeaafeef.tar.gz |
Fix passing game options to setup function.
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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; |