diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-09-10 15:54:09 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-09-10 15:58:35 +0200 |
commit | cb8c881b2792579d5b85e4b7a395e40eba1d3fc5 (patch) | |
tree | 1e5e8191894663bb8d9a862eb1cf45ac3cb16042 /server.js | |
parent | 66a395d7a2dfdb6a627fe04ec06a7a7a921a739b (diff) | |
download | server-cb8c881b2792579d5b85e4b7a395e40eba1d3fc5.tar.gz |
Add clock time when admin rewinds a game and time is low.
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -1296,6 +1296,7 @@ const SQL_FINISH_GAME = SQL(` game_id = ? `) +const SQL_REWIND_GAME_CLOCK = SQL("update players set clock=1 where game_id=? and clock < 1") const SQL_REWIND_GAME = SQL("update games set status=1,moves=?,active=?,mtime=datetime() where game_id=?") const SQL_SELECT_REWIND = SQL("select snap_id, state->>'$.active' as active, state->>'$.state' as state from game_snap where game_id=? order by snap_id desc") @@ -2159,6 +2160,7 @@ function rewind_game_to_snap(game_id, snap_id, res) { SQL_INSERT_GAME_STATE.run(game_id, JSON.stringify(snap_state)) SQL_REWIND_GAME.run(snap_id - 1, snap_state.active, game_id) + SQL_REWIND_GAME_CLOCK.run(game_id) update_join_clients(game_id) if (game_clients[game_id]) |