From 9803f79ed8776723dc7ac98108bc66879f921d23 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 21 Apr 2025 09:20:13 +0200 Subject: Fix replay view of discard pile. In the replay mode the view object is not serialized to JSON before viewing, so we cannot rely on the JSON representation dropping any properties with the value "undefined". Don't use (property in object) to check if something is undefined. Initialize game.discard pile in on_setup as well. --- play.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'play.js') diff --git a/play.js b/play.js index 22ae8a2..1c37e19 100644 --- a/play.js +++ b/play.js @@ -969,8 +969,7 @@ function is_stacked() { } function update_discard() { - // TODO when rewind and needs to empty - if ("discard" in view) { + if (view.discard) { let stacked = is_stacked() ui.discard_pile.style.flexDirection = (stacked ? "column" : "row") for (let i = 0; i < 4; ++i) { -- cgit v1.2.3