From 8ea2481d40d05dbdb07a2b787d016d51f9b89959 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 1 Mar 2025 19:27:37 +0100 Subject: Fix intermittent bug with undo. --- rules.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'rules.ts') diff --git a/rules.ts b/rules.ts index 1939d74..1cc024a 100644 --- a/rules.ts +++ b/rules.ts @@ -172,11 +172,12 @@ export function action( action: string, arg: unknown ) { - if (action !== 'undo' && state.state !== 'choose_card') { - state.undo = push_undo(); + game = state; + + if (action !== 'undo' && game.state !== 'choose_card') { + push_undo(); } - game = state; let S = states[game.state]; if (action in S) S[action](arg, player); else if (action === 'undo' && game.undo && game.undo.length > 0) pop_undo(); -- cgit v1.2.3