diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-01-02 19:55:49 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-01-02 19:55:49 +0100 |
commit | faba28c7c3c55124f8be117cfee9d75b33ec1c7c (patch) | |
tree | a47de7eabe4eea2bea14477fd51656d4e2c55386 | |
parent | 150b08878acd945100024d54634bb396bbb3c3cc (diff) | |
download | washingtons-war-faba28c7c3c55124f8be117cfee9d75b33ec1c7c.tar.gz |
Stable undo.
-rw-r--r-- | rules.js | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; |