mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 08:52:15 -07:00
wip
This commit is contained in:
parent
6fdee56d09
commit
79e284ba9b
3 changed files with 11 additions and 4 deletions
|
|
@ -200,12 +200,12 @@ CardItem *CardZone::takeCard(int position, int cardId, bool /*canResize*/)
|
||||||
if (position >= cards.size())
|
if (position >= cards.size())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
CardItem *c = cards.takeAt(position);
|
|
||||||
|
|
||||||
for (auto *view : views) {
|
for (auto *view : views) {
|
||||||
view->removeCard(position);
|
view->removeCard(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CardItem *c = cards.takeAt(position);
|
||||||
|
|
||||||
c->setId(cardId);
|
c->setId(cardId);
|
||||||
|
|
||||||
reorganizeCards();
|
reorganizeCards();
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ ZoneViewZone::ZoneViewZone(Player *_p,
|
||||||
: SelectZone(_p, _origZone->getName(), false, false, true, parent, true), bRect(QRectF()), minRows(0),
|
: SelectZone(_p, _origZone->getName(), false, false, true, parent, true), bRect(QRectF()), minRows(0),
|
||||||
numberCards(_numberCards), origZone(_origZone), revealZone(_revealZone),
|
numberCards(_numberCards), origZone(_origZone), revealZone(_revealZone),
|
||||||
writeableRevealZone(_writeableRevealZone), groupBy(CardList::NoSort), sortBy(CardList::NoSort),
|
writeableRevealZone(_writeableRevealZone), groupBy(CardList::NoSort), sortBy(CardList::NoSort),
|
||||||
isReversed(_isReversed), firstCardId(-1)
|
isReversed(_isReversed), firstCardId(-1), previousOrigSize(-1)
|
||||||
{
|
{
|
||||||
if (!(revealZone && !writeableRevealZone)) {
|
if (!(revealZone && !writeableRevealZone)) {
|
||||||
origZone->getViews().append(this);
|
origZone->getViews().append(this);
|
||||||
|
|
@ -107,6 +107,7 @@ void ZoneViewZone::zoneDumpReceived(const Response &r)
|
||||||
firstCardId = cardInfo.id();
|
firstCardId = cardInfo.id();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
previousOrigSize = origZone->getCards().size();
|
||||||
reorganizeCards();
|
reorganizeCards();
|
||||||
emit cardCountChanged();
|
emit cardCountChanged();
|
||||||
}
|
}
|
||||||
|
|
@ -126,6 +127,11 @@ void ZoneViewZone::reorganizeCards()
|
||||||
if (cards.first()->getId() != firstCardId) {
|
if (cards.first()->getId() != firstCardId) {
|
||||||
startId -= 1;
|
startId -= 1;
|
||||||
}
|
}
|
||||||
|
if (origZone->getCards().size() != previousOrigSize) {
|
||||||
|
qDebug() << "TRACK origZoneSize changed" << "orig" << origZone->getCards().size() << "prev"
|
||||||
|
<< previousOrigSize;
|
||||||
|
previousOrigSize = origZone->getCards().size();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < cardCount; ++i) {
|
for (int i = 0; i < cardCount; ++i) {
|
||||||
|
|
@ -231,7 +237,7 @@ ZoneViewZone::GridSize ZoneViewZone::positionCardsForDisplay(CardList &cards, Ca
|
||||||
if (cols < 2)
|
if (cols < 2)
|
||||||
cols = 2;
|
cols = 2;
|
||||||
|
|
||||||
qDebug() << "reorganizeCards: rows=" << rows << "cols=" << cols;
|
qDebug() << "reorganizeCards: rows=" << rows << "cols=" << cols;
|
||||||
|
|
||||||
for (int i = 0; i < cardCount; i++) {
|
for (int i = 0; i < cardCount; i++) {
|
||||||
CardItem *c = cards.at(i);
|
CardItem *c = cards.at(i);
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ private:
|
||||||
bool pileView;
|
bool pileView;
|
||||||
bool isReversed;
|
bool isReversed;
|
||||||
int firstCardId;
|
int firstCardId;
|
||||||
|
int previousOrigSize;
|
||||||
|
|
||||||
struct GridSize
|
struct GridSize
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue