mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-14 19:18:55 -07:00
make unattach shortcut always active (#5278)
This commit is contained in:
parent
a54a424f84
commit
0d99b2bcf4
1 changed files with 9 additions and 4 deletions
|
|
@ -1009,6 +1009,10 @@ void Player::setShortcutsActive()
|
||||||
game->addAction(aClone);
|
game->addAction(aClone);
|
||||||
game->addAction(aDrawArrow);
|
game->addAction(aDrawArrow);
|
||||||
game->addAction(aSelectAll);
|
game->addAction(aSelectAll);
|
||||||
|
|
||||||
|
// unattach action is only active in card menu if the active card is attached.
|
||||||
|
// make unattach shortcut always active so that it consistently works when multiple cards are selected.
|
||||||
|
game->addAction(aUnattach);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3491,13 +3495,14 @@ void Player::actAttach()
|
||||||
|
|
||||||
void Player::actUnattach()
|
void Player::actUnattach()
|
||||||
{
|
{
|
||||||
if (!game->getActiveCard()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<const ::google::protobuf::Message *> commandList;
|
QList<const ::google::protobuf::Message *> commandList;
|
||||||
for (QGraphicsItem *item : scene()->selectedItems()) {
|
for (QGraphicsItem *item : scene()->selectedItems()) {
|
||||||
auto *card = static_cast<CardItem *>(item);
|
auto *card = static_cast<CardItem *>(item);
|
||||||
|
|
||||||
|
if (!card->getAttachedTo()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
auto *cmd = new Command_AttachCard;
|
auto *cmd = new Command_AttachCard;
|
||||||
cmd->set_start_zone(card->getZone()->getName().toStdString());
|
cmd->set_start_zone(card->getZone()->getName().toStdString());
|
||||||
cmd->set_card_id(card->getId());
|
cmd->set_card_id(card->getId());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue