diff --git a/cockatrice/src/player.cpp b/cockatrice/src/player.cpp index 47b27703..32552352 100644 --- a/cockatrice/src/player.cpp +++ b/cockatrice/src/player.cpp @@ -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());