summaryrefslogtreecommitdiff
path: root/scripts/gui/table.js
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-08-18 02:24:31 -0400
committerKyle Gunger <kgunger12@gmail.com>2022-08-18 02:24:31 -0400
commit4b11dd3210df8659241d5d7d555302f03d5cfc54 (patch)
treedb4d322fdffd61efb437dcd809d6beb59bee4cac /scripts/gui/table.js
parent46aae06bd699b3ca396f7f5c750e1fb9fc9ff4bc (diff)
Fix card data
Diffstat (limited to 'scripts/gui/table.js')
-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 51ed4b3..f19cfca 100644
--- a/scripts/gui/table.js
+++ b/scripts/gui/table.js
@@ -91,7 +91,7 @@ class Table{
// {data.deck} the id of the deck to add the card to
newCard(data)
{
- let c = new Card(data.id, data.data);
+ let c = new Card(data.id, data.deck, data.data);
this.cards[data.id] = c;
this.decks[data.deck].appendCard(c);
this.drag.addTarget(c.e);
@@ -114,8 +114,9 @@ class Table{
// {id any} id of card to delete
deleteCard(id)
{
- this.cards[id].getDeck().removeCardByID(id)
- this.cards[id].e.remove();
+ let c = this.cards[id];
+ this.decks[c.deck].removeCardByID(id)
+ c.e.remove();
delete this.cards[id];
}
@@ -127,7 +128,7 @@ class Table{
moveCard(data)
{
let c = this.cards[data.card];
- this.decks[c.getDeck()].removeCardByID(data.card);
+ this.decks[c.deck].removeCardByID(data.card);
this.decks[data.deck].addCardAt(c, data.index);
c.resetPos();
c.e.className = "";