Exemple #1
0
void Fortyeight::restart( const QList<KCard*> & cards )
{
    lastdeal = false;

    QList<KCard*> cardList = cards;

    for ( int r = 0; r < 4; ++r )
    {
        for ( int column = 0; column < 8; ++column )
        {
            QPointF initPos = stack[column]->pos() - QPointF( 0, 2 * deck()->cardHeight() );
            addCardForDeal( stack[column], cardList.takeLast(), true, initPos );
        }
    }

    while ( !cardList.isEmpty() )
    {
        KCard * c = cardList.takeFirst();
        c->setPos( talon->pos() );
        c->setFaceUp( false );
        talon->add( c );
    }

    startDealAnimation();

    flipCardToPile( talon->topCard(), pile, DURATION_MOVE );

    emit newCardsPossible( true );
}
Exemple #2
0
void Gypsy::restart( const QList<KCard*> & cards )
{
    QList<KCard*> cardList = cards;

    for ( int round = 0; round < 8; ++round )
        addCardForDeal(store[round], cardList.takeLast(), false, store[round]->pos() + QPointF(-2*deck()->cardWidth(),-1.1*deck()->cardHeight()));

    for ( int round = 0; round < 8; ++round )
        addCardForDeal(store[round], cardList.takeLast(), true, store[round]->pos() + QPointF(-3*deck()->cardWidth(),-1.6*deck()->cardHeight()));

    for ( int round = 0; round < 8; ++round )
        addCardForDeal(store[round], cardList.takeLast(), true, store[round]->pos() + QPointF(-4*deck()->cardWidth(),-2.1*deck()->cardHeight()));

    while ( !cardList.isEmpty() )
    {
        KCard * c = cardList.takeFirst();
        c->setPos( talon->pos() );
        c->setFaceUp( false );
        talon->add( c );
    }

    startDealAnimation();

    emit newCardsPossible(true);
}
Exemple #3
0
void Grandf::deal( const QList<KCard*> & cardsToDeal )
{
    setKeyboardModeActive( false );

    QList<KCard*> cards = cardsToDeal;

    QPointF initPos( 1.4 * 3 * deck()->cardWidth(), 1.2 * deck()->cardHeight() );

    int start = 0;
    int stop = 7-1;
    int dir = 1;

    for (int round=0; round < 7; round++)
    {
        int i = start;
        do
        {
            if (!cards.isEmpty())
                addCardForDeal( store[i], cards.takeLast(), (i == start), initPos );
            i += dir;
        } while ( i != stop + dir);
        int t = start;
        start = stop;
        stop = t+dir;
        dir = -dir;
    }

    int i = 0;
    while (!cards.isEmpty())
    {
        addCardForDeal( store[i+1], cards.takeLast(), true, initPos );
        i = (i+1)%6;
    }

    for (int round=0; round < 7; round++)
    {
        KCard *c = store[round]->topCard();
        if (c)
            c->setFaceUp(true);
    }

    startDealAnimation();
}
Exemple #4
0
void Spider::restart( const QList<KCard*> & cards )
{
    m_pilesWithRuns.clear();

    // make the redeal piles visible
    for (int i = 0; i < 5; ++i )
        redeals[i]->setVisible( true );

    // make the leg piles invisible
    for (int i = 0; i < 8; ++i )
        legs[i]->setVisible( false );

    recalculatePileLayouts();

    m_leg = 0;
    m_redeal = 0;

    QList<KCard*> cardList = cards;

    int column = 0;
    // deal face down cards (5 to first 4 piles, 4 to last 6)
    for ( int i = 0; i < 44; ++i )
    {
        addCardForDeal( stack[column], cardList.takeLast(), m_stackFaceup == 1, randomPos() );
        column = (column + 1) % 10;
    }
    // deal face up cards, one to each pile
    for ( int i = 0; i < 10; ++i )
    {
        addCardForDeal( stack[column], cardList.takeLast(), true, randomPos() );
        column = (column + 1) % 10;
    }
    // deal the remaining cards into 5 'redeal' piles
    for ( int column = 0; column < 5; ++column )
        for ( int i = 0; i < 10; ++i )
            addCardForDeal( redeals[column], cardList.takeLast(), false, randomPos() );

    startDealAnimation();

    emit newCardsPossible(true);
}