00001 #ifndef PLAYER_H
00002 #define PLAYER_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <QObject>
00025 #include <QVector>
00026
00027
00028 #include <kdebug.h>
00029 #include <kconfig.h>
00030
00031
00032 #include "deck.h"
00033
00034
00035 class AbstractInput;
00036
00037 using namespace CardDeck;
00038
00039
00042 class Player : public QObject
00043 {
00044 Q_OBJECT
00045
00046 public:
00051 Player(int id, QObject* parent=0);
00052
00055 virtual ~Player();
00056
00060 int id() {return mId;}
00061
00066 int getCard(int playerNumber);
00067
00072 void deleteCard(int cardPosition);
00073
00079 void addCard(int cardPosition, int card);
00080
00083 void startTurn();
00084
00087 void stopTurn();
00088
00092 void deal(int amount);
00093
00097 void increaseMovesWon(int amount = 1);
00098
00102 int noOfMovesWon();
00103
00110 void addWonCard(int card);
00111
00116 int getWonCard(int no);
00117
00121 int points();
00122
00127 void setPoints(int points);
00128
00132 QString name();
00133
00138 void setName(QString name);
00139
00144 void addWonGame(int amount);
00145
00149 int wonGames();
00150
00155 void addGame(int amount);
00156
00160 int games();
00161
00166 void addScore(int amount);
00167
00171 int score();
00172
00176 AbstractInput* input();
00177
00181 void setInput(AbstractInput* input);
00182
00186 void setDeck(Deck* deck);
00187
00190 void refresh();
00191
00194 void clear();
00195
00199 void setTrump(Suite trump);
00200
00204 Suite trump();
00205
00209 void save(KConfigGroup& config);
00210
00214 void load(KConfigGroup& config);
00215
00216 signals:
00220 void signalUpdate(Player* p);
00221
00222 private:
00223
00224 AbstractInput* mInput;
00225
00226 Deck* mDeck;
00227
00228 QVector<int> mCards;
00229
00230 QList<int> mWonCards;
00231
00232 int mPoints;
00233
00234 int mId;
00235
00236 int mMovesWon;
00237
00238 Suite mTrump;
00239
00240
00241
00242 QString mName;
00243
00244 int mGamesWon;
00245
00246 int mScore;
00247
00248 int mNumberOfGames;
00249 };
00250
00251 #endif