Logo Search packages:      
Sourcecode: schafkopf version File versions  Download package

QString Results::result (  ) 

get a message of the game results, which can be displayed to the user.

Definition at line 52 of file results.cpp.

References GameInfo::spieler().

Referenced by Game::gameResults().

{
    bool positive = m_laufende > 0;
    parse();
    
    QString s;
    QString schneider = m_schneider ? i18n(" schneider" ) : QString::null;
    QString schwarz = m_schwarz ? i18n(" no-trick") : QString::null;
    Player* winner = m_gameinfo->spieler();
    bool won = m_points > 60;
    
    if( !winner )
    {
        won = m_winners.count() == 1;
        winner = won ? m_winners.at(0) : m_losers.at(0);
    }
    
    if( won )
        s = winner->name() + QString(i18n(" wins with %1 points%2."))
            .arg( m_points ).arg( schneider + schwarz );
    else
        s = winner->name() + QString(i18n(" loses with %1 points%2.") )
            .arg( m_points ).arg( schneider + schwarz );
    
    if( m_laufende )
    {
        if( positive )
            s += "\n" + winner->name() + QString( i18n(" got %1 cards in a row.").arg( m_laufende ) );
        else
            s += "\n" + winner->name() + QString( i18n(" played without %1 cards in a row.").arg( m_laufende ) );
    }
    
    return s;
}


Generated by  Doxygen 1.6.0   Back to index