From 5b4bc044016a2a29913403b1a7d421148c9a9dfd Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Sat, 12 Nov 2022 16:02:53 -0500 Subject: fix swap again --- scripts/gui/table.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/gui/table.js b/scripts/gui/table.js index 01726e2..8ebb9ab 100644 --- a/scripts/gui/table.js +++ b/scripts/gui/table.js @@ -142,12 +142,13 @@ class Table{ swapCard(data) { // Can't swap a card into a an id of a pre-existing card. - if (this.cards[data.id] != null) { + if (data.id == data.card && this.cards[data.id] != null) + this.cards[data.id].generateElements(data.data); + if (this.cards[data.id] != null) return false; - } + this.cards[data.id] = this.cards[data.card]; - if (data.card != data.id) - delete this.cards[data.card]; + delete this.cards[data.card]; this.cards[data.id].id = data.id; this.cards[data.id].generateElements(data.data); } -- cgit v1.2.3