summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-01-02 19:55:49 +0100
committerTor Andersson <tor@ccxvii.net>2022-01-02 19:55:49 +0100
commitfaba28c7c3c55124f8be117cfee9d75b33ec1c7c (patch)
treea47de7eabe4eea2bea14477fd51656d4e2c55386 /rules.js
parent150b08878acd945100024d54634bb396bbb3c3cc (diff)
downloadwashingtons-war-faba28c7c3c55124f8be117cfee9d75b33ec1c7c.tar.gz
Stable undo.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js4
1 files 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;