From a80ccd882c5b66a50148aa0b6c678925a6d56acb Mon Sep 17 00:00:00 2001 From: Matt Lowe Date: Wed, 1 Oct 2014 00:57:07 +0200 Subject: [PATCH 1/2] Tokens use PT levels from cards.xml if available I added a check to see if the event PT is empty, if it is, we try and use the PT from the cards.xml. In resp to issue #330. --- cockatrice/src/player.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/player.cpp b/cockatrice/src/player.cpp index b63f0a0d..e8edd985 100644 --- a/cockatrice/src/player.cpp +++ b/cockatrice/src/player.cpp @@ -1093,7 +1093,12 @@ void Player::eventCreateToken(const Event_CreateToken &event) CardItem *card = new CardItem(this, QString::fromStdString(event.card_name()), event.card_id()); card->setColor(QString::fromStdString(event.color())); - card->setPT(QString::fromStdString(event.pt())); + + // use db p/t if not provided in event + if (QString::fromStdString(event.pt()).isEmpty()) + card->setPT(db->getCard(QString::fromStdString(event.card_name()))->getPowTough()); + else + card->setPT(QString::fromStdString(event.pt())); card->setAnnotation(QString::fromStdString(event.annotation())); card->setDestroyOnZoneChange(event.destroy_on_zone_change()); From e3a94ecca352a146908fdd0c4c5726fa2f418874 Mon Sep 17 00:00:00 2001 From: Matt Lowe Date: Wed, 1 Oct 2014 19:20:42 +0200 Subject: [PATCH 2/2] Token PT is now set to DB values if not defined in event. --- cockatrice/src/player.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cockatrice/src/player.cpp b/cockatrice/src/player.cpp index e8edd985..16b77eae 100644 --- a/cockatrice/src/player.cpp +++ b/cockatrice/src/player.cpp @@ -1092,13 +1092,12 @@ void Player::eventCreateToken(const Event_CreateToken &event) return; CardItem *card = new CardItem(this, QString::fromStdString(event.card_name()), event.card_id()); - card->setColor(QString::fromStdString(event.color())); - - // use db p/t if not provided in event - if (QString::fromStdString(event.pt()).isEmpty()) - card->setPT(db->getCard(QString::fromStdString(event.card_name()))->getPowTough()); - else + // use db PT if not provided in event + if (!QString::fromStdString(event.pt()).isEmpty()) card->setPT(QString::fromStdString(event.pt())); + else + card->setPT(db->getCard(QString::fromStdString(event.card_name()))->getPowTough()); + card->setColor(QString::fromStdString(event.color())); card->setAnnotation(QString::fromStdString(event.annotation())); card->setDestroyOnZoneChange(event.destroy_on_zone_change());