Merge pull request #1736 from ZeldaZach/token_loc

Token coordinates
This commit is contained in:
Zach 2015-12-30 11:54:59 -05:00
commit 924bbb2245

View file

@ -1138,11 +1138,13 @@ void Player::actCreateRelatedCard()
// removes p/t from tokens (and leading space))
QStringList spaces = action->text().split(" ");
if (spaces.at(0).indexOf("/") != -1) // Strip space from creatures
spaces.removeFirst();
CardInfo *cardInfo = db->getCard(spaces.join(" "));
// get the target token's location
// TODO: Define this QPoint into its own function along with the one below
QPoint gridPoint = QPoint(-1, table->clampValidTableRow(2 - cardInfo->getTableRow()));
// create the token for the related card
Command_CreateToken cmd;
@ -1153,6 +1155,9 @@ void Player::actCreateRelatedCard()
cmd.set_annotation(settingsCache->getAnnotateTokens() ? cardInfo->getText().toStdString() : QString().toStdString());
cmd.set_destroy_on_zone_change(true);
cmd.set_target_zone(sourceCard->getZone()->getName().toStdString());
cmd.set_x(gridPoint.x());
cmd.set_y(gridPoint.y());
if(!cardInfo->getIsToken())
cmd.set_target_card_id(sourceCard->getId());