From e06b0cc6cc27899f6f29958c16b04d44d152859b Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 6 Jan 2022 12:36:53 +0100 Subject: Update for new server version. --- rules.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 11ca1dd..673ef5a 100644 --- a/rules.js +++ b/rules.js @@ -334,7 +334,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; })); @@ -343,7 +343,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; @@ -2880,7 +2880,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) { @@ -2891,9 +2891,11 @@ exports.resign = function (state, current) { if (current === TR) goto_game_over(US, "Tripolitania resigned."); } - return state; + return game; } +exports.is_checkpoint = (a, b) => a.season !== b.season; + exports.view = function(state, current) { game = state; -- cgit v1.2.3