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.
This commit is contained in:
Matt Lowe 2014-10-01 00:57:07 +02:00
parent ab7f354e36
commit a80ccd882c

View file

@ -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());