diff options
-rw-r--r-- | rules.js | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -258,7 +258,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; })); @@ -267,7 +267,7 @@ function push_undo() { function pop_undo() { let save_undo = game.undo; let save_log = game.log; - Object.assign(game, JSON.parse(save_undo.pop())); + game = JSON.parse(save_undo.pop()); game.undo = save_undo; save_log.length = game.log; game.log = save_log; @@ -3362,7 +3362,7 @@ exports.action = function (state, current, action, arg) { S[action](arg, current); else throw new Error("Invalid action: " + action); - return state; + return game; } exports.resign = function (state, current) { @@ -3378,9 +3378,11 @@ exports.resign = function (state, current) { else game.result = PERSIA; } - return state; + return game; } +exports.checkpoints = [ "campaign" ]; + exports.view = function(state, current) { game = state; |