mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 00:54:53 -07:00
implement a maximum amount of cardmenus generated for views (#4262)
This commit is contained in:
parent
8e1d7d12e0
commit
00ed5c370c
3 changed files with 23 additions and 9 deletions
|
|
@ -83,15 +83,19 @@ void ZoneViewZone::initializeCards(const QList<const ServerInfo_Card *> &cardLis
|
|||
|
||||
void ZoneViewZone::zoneDumpReceived(const Response &r)
|
||||
{
|
||||
static constexpr int MAX_VIEW_MENU = 300;
|
||||
const Response_DumpZone &resp = r.GetExtension(Response_DumpZone::ext);
|
||||
const int respCardListSize = resp.zone_info().card_list_size();
|
||||
for (int i = 0; i < respCardListSize; ++i) {
|
||||
const ServerInfo_Card &cardInfo = resp.zone_info().card_list(i);
|
||||
CardItem *card = new CardItem(player, QString::fromStdString(cardInfo.name()), cardInfo.id(), revealZone, this);
|
||||
addCard(card, false, i);
|
||||
auto cardName = QString::fromStdString(cardInfo.name());
|
||||
// stop updating card menus after MAX_VIEW_MENU cards
|
||||
// this means only the first cards in the menu have actions but others can still be dragged
|
||||
auto *card = new CardItem(player, cardName, cardInfo.id(), revealZone, this, this, i < MAX_VIEW_MENU);
|
||||
cards.insert(i, card);
|
||||
}
|
||||
|
||||
reorganizeCards();
|
||||
emit cardCountChanged();
|
||||
}
|
||||
|
||||
// Because of boundingRect(), this function must not be called before the zone was added to a scene.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue