From f2bef5476e70a2925d8c854236c2002d47b51844 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 15 Jun 2022 14:04:16 +0200 Subject: Optimize retroactive foul weather! There's only ever one foul weather state on the undo stack, so don't include the full foul weather state into the undo state. --- rules.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rules.js b/rules.js index 46b9a42..307f318 100644 --- a/rules.js +++ b/rules.js @@ -9392,6 +9392,7 @@ function push_undo() { game.undo.push(JSON.stringify(game, (k,v) => { if (k === 'undo') return 0 if (k === 'log') return v.length + if (k === 'retro_foul_weather') return 1 return v })) } @@ -9399,10 +9400,13 @@ function push_undo() { function pop_undo() { let save_undo = game.undo let save_log = game.log + let save_retro_fw = game.retro_foul_weather game = JSON.parse(save_undo.pop()) game.undo = save_undo save_log.length = game.log game.log = save_log + if (game.retro_foul_weather) + game.retro_foul_weather = save_retro_fw update_active_aliases() } -- cgit v1.2.3