From 0d99b2bcf4d2bd5ab0b1406fda92780a293668f1 Mon Sep 17 00:00:00 2001 From: RickyRister <42636155+RickyRister@users.noreply.github.com> Date: Thu, 19 Dec 2024 21:56:48 -0800 Subject: [PATCH] make unattach shortcut always active (#5278) --- cockatrice/src/game/player/player.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cockatrice/src/game/player/player.cpp b/cockatrice/src/game/player/player.cpp index a2fe6b089..4efef82b2 100644 --- a/cockatrice/src/game/player/player.cpp +++ b/cockatrice/src/game/player/player.cpp @@ -1009,6 +1009,10 @@ void Player::setShortcutsActive() game->addAction(aClone); game->addAction(aDrawArrow); 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() { - if (!game->getActiveCard()) { - return; - } - QList commandList; for (QGraphicsItem *item : scene()->selectedItems()) { auto *card = static_cast(item); + + if (!card->getAttachedTo()) { + continue; + } + auto *cmd = new Command_AttachCard; cmd->set_start_zone(card->getZone()->getName().toStdString()); cmd->set_card_id(card->getId());