diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-01-06 12:36:53 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 12:12:42 +0100 |
commit | e06b0cc6cc27899f6f29958c16b04d44d152859b (patch) | |
tree | c0fd79c0b4d5265c3a95fd70f55c4c4f72a7070a /rules.js | |
parent | 990c198dc1fee95d5de6328f47172bac31bac9aa (diff) | |
download | shores-of-tripoli-e06b0cc6cc27899f6f29958c16b04d44d152859b.tar.gz |
Update for new server version.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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; |