mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 00:42:14 -07:00
works now
This commit is contained in:
parent
0ed883883a
commit
a06fc6adb1
1 changed files with 14 additions and 10 deletions
|
|
@ -278,20 +278,24 @@ void ZoneViewZone::setPileView(int _pileView)
|
||||||
|
|
||||||
void ZoneViewZone::addCardImpl(CardItem *card, int x, int /*y*/)
|
void ZoneViewZone::addCardImpl(CardItem *card, int x, int /*y*/)
|
||||||
{
|
{
|
||||||
// if x is negative set it to add at end
|
if (!isReversed) {
|
||||||
if (x < 0 || x >= cards.size()) {
|
// if x is negative set it to add at end
|
||||||
x = cards.size();
|
if (x < 0) {
|
||||||
}
|
x = cards.size();
|
||||||
|
}
|
||||||
if (isReversed) {
|
cards.insert(x, card);
|
||||||
if (x != 0) {
|
} else {
|
||||||
cards.append(card);
|
// map x (which is in origZone indexes) to this viewZone's cardList index
|
||||||
|
int firstId = cards.isEmpty() ? origZone->getCards().size() : cards.front()->getId();
|
||||||
|
int insertionIndex = x - firstId;
|
||||||
|
if (insertionIndex >= 0) {
|
||||||
|
// card was put into a portion of the deck that's in the view
|
||||||
|
cards.insert(insertionIndex, card);
|
||||||
} else {
|
} else {
|
||||||
|
// card was put into a portion of the deck that's not in the view
|
||||||
updateCardIds(ADD_CARD);
|
updateCardIds(ADD_CARD);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
cards.insert(x, card);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
card->setParentItem(this);
|
card->setParentItem(this);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue