diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-06-17 10:34:01 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2021-06-17 11:48:41 +0200 |
commit | 889c1b988ad22485cd8d515aa1ce9fd418707f41 (patch) | |
tree | e0927e00e76928596959f2e5bdf2b55d13d9457c /server.js | |
parent | 23ff001edff2a150658c47db05dccb6b41ec37a5 (diff) | |
download | server-889c1b988ad22485cd8d515aa1ce9fd418707f41.tar.gz |
Keep random flag after starting a game for rematch purposes.
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -486,7 +486,7 @@ const QUERY_ROLE_FROM_GAME_AND_USER = db.prepare("SELECT role FROM players WHERE const QUERY_JOIN_GAME = db.prepare("INSERT INTO players (user_id, game_id, role) VALUES (?,?,?)"); const QUERY_PART_GAME = db.prepare("DELETE FROM players WHERE game_id = ? AND user_id = ? AND role = ?"); -const QUERY_START_GAME = db.prepare("UPDATE games SET random = 0, status = 1, state = ?, active = ? WHERE game_id = ?"); +const QUERY_START_GAME = db.prepare("UPDATE games SET status = 1, state = ?, active = ? WHERE game_id = ?"); const QUERY_CREATE_GAME = db.prepare(` INSERT INTO games (owner,title_id,scenario,private,random,ctime,mtime,description,status,state,chat) @@ -673,7 +673,7 @@ app.get('/join/:game_id', must_be_logged_in, function (req, res) { return res.redirect('/'); } let roles = QUERY_ROLES.all(game.title_id); - if (game.random) + if (game.random && game.status == 0) for (let i = 0; i < roles.length; ++i) roles[i] = "Random " + (i+1); let players = QUERY_PLAYERS.all(game_id); |