diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2022-11-12 16:02:53 -0500 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2022-11-12 16:02:53 -0500 |
commit | 5b4bc044016a2a29913403b1a7d421148c9a9dfd (patch) | |
tree | 3bac275892c30b9cf2480596d4fab04ce0ff3dc5 /scripts/gui | |
parent | 5014dd1dfb57bf7921fb9ca53ba036aa6e16beeb (diff) |
fix swap again
Diffstat (limited to 'scripts/gui')
-rw-r--r-- | scripts/gui/table.js | 9 |
1 files 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); } |