Move defaultOptions up a level

This commit is contained in:
RickyRister 2025-11-06 18:49:36 -08:00 committed by Lukas Brübach
parent 36e68d86be
commit f5426b2236
2 changed files with 5 additions and 7 deletions

View file

@ -161,12 +161,14 @@ static QList<CardList::SortOption> expandSortOption(CardList::SortOption option)
void PlayerActions::actSortHand() void PlayerActions::actSortHand()
{ {
auto *action = static_cast<QAction *>(sender()); auto *action = qobject_cast<QAction *>(sender());
CardList::SortOption option = static_cast<CardList::SortOption>(action->data().toInt()); CardList::SortOption option = static_cast<CardList::SortOption>(action->data().toInt());
QList<CardList::SortOption> sortOptions = expandSortOption(option); QList<CardList::SortOption> sortOptions = expandSortOption(option);
player->getGraphicsItem()->getHandZoneGraphicsItem()->sortHand(sortOptions); static QList defaultOptions = {CardList::SortByName, CardList::SortByPrinting};
player->getGraphicsItem()->getHandZoneGraphicsItem()->sortHand(sortOptions + defaultOptions);
} }
void PlayerActions::actViewTopCards() void PlayerActions::actViewTopCards()

View file

@ -117,11 +117,7 @@ void HandZone::sortHand(const QList<CardList::SortOption> &options)
return; return;
} }
// Implicitly sort by name at the end so that cards with the same name appear together. getLogic()->sortCards(options);
// Also group printings together
static QList defaultOptions = {CardList::SortByName, CardList::SortByPrinting};
getLogic()->sortCards(options + defaultOptions);
reorganizeCards(); reorganizeCards();
} }