summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-11-12 16:02:53 -0500
committerKyle Gunger <kgunger12@gmail.com>2022-11-12 16:02:53 -0500
commit5b4bc044016a2a29913403b1a7d421148c9a9dfd (patch)
tree3bac275892c30b9cf2480596d4fab04ce0ff3dc5 /scripts
parent5014dd1dfb57bf7921fb9ca53ba036aa6e16beeb (diff)
fix swap again
Diffstat (limited to 'scripts')
-rw-r--r--scripts/gui/table.js9
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);
}