From faba28c7c3c55124f8be117cfee9d75b33ec1c7c Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 2 Jan 2022 19:55:49 +0100 Subject: Stable undo. --- rules.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rules.js b/rules.js index 09f5a11..85c9861 100644 --- a/rules.js +++ b/rules.js @@ -78,7 +78,7 @@ function clear_undo() { function push_undo() { game.undo.push(JSON.stringify(game, (k,v) => { - if (k === 'undo') return undefined; + if (k === 'undo') return 0; if (k === 'log') return v.length; return v; })); @@ -87,7 +87,7 @@ function push_undo() { function pop_undo() { let undo = game.undo; let save_log = game.log; - Object.assign(game, JSON.parse(undo.pop())); + game = JSON.parse(undo.pop()); game.undo = undo; save_log.length = game.log; game.log = save_log; -- cgit v1.2.3