diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-01-04 14:42:54 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-01-31 12:39:03 +0100 |
commit | e94eac9df7688b8742eac0ccd13bad897013bfbc (patch) | |
tree | 335477d0931173db66f2c97601023939183e9b93 | |
parent | ddc4a5678adb3b0c9baddbed8e265d4b26c8e474 (diff) | |
download | server-e94eac9df7688b8742eac0ccd13bad897013bfbc.tar.gz |
Allow debugging "restored" games.
-rw-r--r-- | public/common/play.js | 3 | ||||
-rw-r--r-- | tools/patchgame.js | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/public/common/play.js b/public/common/play.js index 9e330c0..2059678 100644 --- a/public/common/play.js +++ b/public/common/play.js @@ -776,6 +776,9 @@ async function init_replay(debug) { function eval_action(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/tools/patchgame.js b/tools/patchgame.js index 167aca9..d0a27f0 100644 --- a/tools/patchgame.js +++ b/tools/patchgame.js @@ -47,8 +47,11 @@ try { game = rules.setup(args[0], args[1], args[2]) else if (item.action === 'resign') game = rules.resign(game, item.role) - else { - console.log("ACTION", i, game.seed, game.state, game.active, ">", item.role, item.action, item.arguments) + else if (item.action === 'restore') { + game = JSON.parse(args) + console.log("RESTORE", i, game.state, game.active) + } 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)) { console.log(`invalid action: ${item.role} ${item.action} ${item.arguments}`) |