Attach and Unattach apply to entire selection (#4651)

* (un)attach applies to entire selection

* additional code formatting, just because it's nicer

Co-authored-by: ebbit1q <ebbit1q@gmail.com>
This commit is contained in:
cajun 2022-08-25 20:26:29 -05:00 committed by GitHub
parent a2624e36f3
commit b5305aa5e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 72 additions and 29 deletions

View file

@ -3186,9 +3186,7 @@ void Player::actAttach()
return;
}
auto *arrow = new ArrowAttachItem(card);
scene()->addItem(arrow);
arrow->grabMouse();
card->drawAttachArrow();
}
void Player::actUnattach()
@ -3197,10 +3195,15 @@ void Player::actUnattach()
return;
}
Command_AttachCard cmd;
cmd.set_start_zone(game->getActiveCard()->getZone()->getName().toStdString());
cmd.set_card_id(game->getActiveCard()->getId());
sendGameCommand(cmd);
QList<const ::google::protobuf::Message *> commandList;
for (QGraphicsItem *item : scene()->selectedItems()) {
auto *card = static_cast<CardItem *>(item);
auto *cmd = new Command_AttachCard;
cmd->set_start_zone(card->getZone()->getName().toStdString());
cmd->set_card_id(card->getId());
commandList.append(cmd);
}
sendGameCommand(prepareGameCommand(commandList));
}
void Player::actCardCounterTrigger()