mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 17:02:15 -07:00
untap will work when cards are selected across multiple zones
This commit is contained in:
parent
0f002ae067
commit
e4dd2f3688
1 changed files with 12 additions and 1 deletions
|
|
@ -213,7 +213,18 @@ void TableZone::reorganizeCards()
|
|||
|
||||
void TableZone::toggleTapped()
|
||||
{
|
||||
QList<QGraphicsItem *> selectedItems = scene()->selectedItems();
|
||||
QList<QGraphicsItem *> selectedItemsRaw = scene()->selectedItems();
|
||||
QList<QGraphicsItem *> selectedItems;
|
||||
|
||||
auto isCardOnTable = [](const QGraphicsItem *item) {
|
||||
if (auto card = qgraphicsitem_cast<const CardItem *>(item)) {
|
||||
return card->getZone()->getName() == "table";
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
std::copy_if(selectedItemsRaw.begin(), selectedItemsRaw.end(), std::back_inserter(selectedItems), isCardOnTable);
|
||||
|
||||
bool tapAll = std::any_of(selectedItems.begin(), selectedItems.end(), [](const QGraphicsItem *item) {
|
||||
return !qgraphicsitem_cast<const CardItem *>(item)->getTapped();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue