diff options
-rw-r--r-- | public/common/play.js | 10 | ||||
-rw-r--r-- | server.js | 4 |
2 files changed, 10 insertions, 4 deletions
diff --git a/public/common/play.js b/public/common/play.js index ede3a5b..9432be4 100644 --- a/public/common/play.js +++ b/public/common/play.js @@ -382,7 +382,7 @@ function connect_play() { break; case 'save': - window.localStorage[params.title_id + "/save"] = msg; + window.localStorage[params.title_id + "/save"] = arg; break; } } @@ -643,7 +643,13 @@ async function init_replay() { ss = Object.assign({}, s); } - eval_action(replay[p]); + try { + eval_action(replay[p]); + } catch (err) { + console.log("ERROR IN REPLAY", p, replay[p], s.state, s.automatic_disruption); + replay.length = p; + break; + } replay[p].digest = adler32(JSON.stringify(s)); for (let k = p-1; k > 0; --k) { @@ -973,14 +973,14 @@ function is_solo(players) { function format_options(options) { function to_english(k) { - if (k === true) return 'yes'; + if (k === true || k === 1) return 'yes'; if (k === false) return 'no'; return k.replace(/_/g, " ").replace(/^\w/, c => c.toUpperCase()); } if (!options || options === '{}') return "None"; options = JSON.parse(options); - return Object.entries(options||{}).map(([k,v]) => v === true ? to_english(k) : `${to_english(k)}=${to_english(v)}`).join(", "); + return Object.entries(options||{}).map(([k,v]) => (v === true || v === 1) ? to_english(k) : `${to_english(k)}=${to_english(v)}`).join(", "); } function annotate_game(game, user_id) { |