File indexing completed on 2022-09-20 13:02:52

0001 /***************************************************************************
0002  *   Copyright (C) 2005, 2008 by Albert Astals Cid <aacid@kde.org>         *
0003  *                                                                         *
0004  *   This program is free software; you can redistribute it and/or modify  *
0005  *   it under the terms of the GNU General Public License as published by  *
0006  *   the Free Software Foundation; either version 2 of the License, or     *
0007  *   (at your option) any later version.                                   *
0008  ***************************************************************************/
0009 
0010 #ifndef PLAYER_H
0011 #define PLAYER_H
0012 
0013 #include <QString>
0014 
0015 class player
0016 {
0017     public:
0018         player();
0019         
0020         void setName(const QString &name);
0021         QString name() const;
0022 
0023         bool isHuman() const;
0024         void setHuman(bool human);
0025         
0026         void initScores();
0027         
0028         // score, bonus, lowerTotal and grandTotal return < 0 when have *no* value
0029         
0030         int score(int index) const;
0031         void setScore(int index, int value);
0032         
0033         int bonus() const;
0034         int upperTotal() const;
0035         int upperTotalWithBonus() const;
0036         int lowerTotal() const;
0037         int grandTotal() const;
0038 
0039         bool allScores() const;
0040         bool noScores() const;
0041     
0042     private:
0043         int scoreRange(int begin, int end) const;
0044         
0045         bool m_human;
0046         QString m_name;
0047         int m_scores[13];
0048 };
0049 
0050 #endif