summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-06-15 14:04:16 +0200
committerTor Andersson <tor@ccxvii.net>2023-02-18 11:54:52 +0100
commitf2bef5476e70a2925d8c854236c2002d47b51844 (patch)
tree841ddf5e28e58a4015999c5895efeeba39947d5f
parent513a78ecd0c6e714b86d7e5876115fa161d635a4 (diff)
downloadwilderness-war-f2bef5476e70a2925d8c854236c2002d47b51844.tar.gz
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.
-rw-r--r--rules.js4
1 files changed, 4 insertions, 0 deletions
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()
}