Support viewing the bottom X cards of library (#5410)

* Get cardIds to update properly in bottom view (#5414)

* Get bottom view to update properly when card is inserted into known portion (#5415)

---------

Co-authored-by: RickyRister <42636155+RickyRister@users.noreply.github.com>
This commit is contained in:
Zach H 2025-01-05 21:17:18 -05:00 committed by GitHub
parent 81b85e97df
commit 6078dd092a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 154 additions and 41 deletions

View file

@ -5,6 +5,7 @@
#include "../player/player.h"
#include "pb/command_move_card.pb.h"
#include "pb/serverinfo_user.pb.h"
#include "pile_zone.h"
#include "view_zone.h"
#include <QAction>
@ -151,7 +152,7 @@ void CardZone::addCard(CardItem *card, const bool reorganize, const int x, const
}
for (auto *view : views) {
if ((x <= view->getCards().size()) || (view->getNumberCards() == -1)) {
if (view->getIsReversed() || (x <= view->getCards().size()) || (view->getNumberCards() == -1)) {
view->addCard(new CardItem(player, nullptr, card->getName(), card->getProviderId(), card->getId()),
reorganize, x, y);
}
@ -199,12 +200,12 @@ CardItem *CardZone::takeCard(int position, int cardId, bool /*canResize*/)
if (position >= cards.size())
return nullptr;
CardItem *c = cards.takeAt(position);
for (auto *view : views) {
view->removeCard(position);
}
CardItem *c = cards.takeAt(position);
c->setId(cardId);
reorganizeCards();