Card *Fortyeight::newCards() { if (Deck::deck()->isEmpty() && lastdeal) return 0; if (pile->top() && pile->top()->animated()) return pile->top(); if (Deck::deck()->isEmpty()) { lastdeal = true; while (!pile->isEmpty()) { Card *c = pile->at(pile->cardsLeft()-1); c->stopAnimation(); Deck::deck()->add(c, true); } } Card *c = Deck::deck()->nextCard(); pile->add(c, true); c->stopAnimation(); qreal x = c->realX(); qreal y = c->realY(); c->setPos( Deck::deck()->pos() ); c->flipTo(x, y, DURATION_FLIP ); takeState(); considerGameStarted(); if ( Deck::deck()->isEmpty() && lastdeal ) emit newCardsPossible( false ); return c; }
void Klondike::deal3() { int draw; if ( EasyRules ) { draw = 1; } else { draw = 3; } pile->clearSpread(); if (deck->isEmpty()) { redeal(); return; } // move the cards back on the deck, so we can have three new for (int i = 0; i < pile->cardsLeft(); ++i) { pile->at(i)->move(pile->x(), pile->y()); } for (int flipped = 0; flipped < draw ; ++flipped) { Card *item = deck->nextCard(); if (!item) { kdDebug(11111) << "deck empty!!!\n"; return; } pile->add(item, true, true); // facedown, nospread if (flipped < draw - 1) pile->addSpread(item); // move back to flip item->move(deck->x(), deck->y()); item->flipTo( int(pile->x()) + pile->dspread() * (flipped), int(pile->y()), 8 * (flipped + 1) ); } }