From 89752a9f5c3876e81ecbd7314f9740644a8ba56b Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 17 Mar 2023 13:20:15 +0100 Subject: Avoid action name collision with debugging command "restore". --- public/common/play.js | 3 --- server.js | 2 +- tools/patchgame.js | 5 +---- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/public/common/play.js b/public/common/play.js index dde8a5d..dce1573 100644 --- a/public/common/play.js +++ b/public/common/play.js @@ -802,9 +802,6 @@ async function init_replay() { function eval_action(item, p) { let [ item_role, item_action, item_arguments ] = item switch (item_action) { - case "restore": - s = JSON.parse(item_arguments) - break case "setup": s = rules.setup(item_arguments[0], item_arguments[1], item_arguments[2]) break diff --git a/server.js b/server.js index b73221f..d492935 100644 --- a/server.js +++ b/server.js @@ -2222,7 +2222,7 @@ function on_restore(socket, state_text) { state_text = JSON.stringify(state) SQL_UPDATE_GAME_RESULT.run(1, null, socket.game_id) SQL_UPDATE_GAME_STATE.run(socket.game_id, state_text, state.active) - put_replay(socket.game_id, null, 'restore', state_text) + put_replay(socket.game_id, null, 'debug-restore', state_text) for (let other of game_clients[socket.game_id]) send_state(other, state) } catch (err) { diff --git a/tools/patchgame.js b/tools/patchgame.js index d0a27f0..42b6c57 100644 --- a/tools/patchgame.js +++ b/tools/patchgame.js @@ -47,10 +47,7 @@ try { game = rules.setup(args[0], args[1], args[2]) else if (item.action === 'resign') game = rules.resign(game, item.role) - else if (item.action === 'restore') { - game = JSON.parse(args) - console.log("RESTORE", i, game.state, game.active) - } else { + else { console.log("ACTION", i, game.state, game.active, ">", item.role, item.action, item.arguments) if (VERIFY) { if (!is_valid_action(rules, game, item.role, item.action, args)) { -- cgit v1.2.3