summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-12-03 01:21:10 +0100
committerTor Andersson <tor@ccxvii.net>2021-12-03 01:21:25 +0100
commit383b23d98fa3eafe82b2dd63eebbfe60aeaafeef (patch)
tree1bbb62ca948a3d355eab39d159961d5d662aa0bb
parentc31a0939759c5518dd3dfa10c41a14ee0eb534eb (diff)
downloadserver-383b23d98fa3eafe82b2dd63eebbfe60aeaafeef.tar.gz
Fix passing game options to setup function.
-rw-r--r--server.js7
1 files 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;