player.h

Go to the documentation of this file.
00001 #ifndef PLAYER_H
00002 #define PLAYER_H
00003 /*
00004    This file is part of the KDE games lskat program
00005    Copyright (c) 2006 Martin Heni <kde@heni-online.de>
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public License
00018    along with this library; see the file COPYING.LIB.  If not, write to
00019    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020    Boston, MA 02110-1301, USA.
00021 */
00022 
00023 // Qt includes
00024 #include <QObject>
00025 #include <QVector>
00026 
00027 // KDE includes
00028 #include <kdebug.h>
00029 #include <kconfig.h>
00030 
00031 // Local includes
00032 #include "deck.h"
00033 
00034 // Forward declaration
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     // Players input device 
00224     AbstractInput* mInput;
00225     // Card deck 
00226     Deck* mDeck;
00227     // Our cards 
00228     QVector<int> mCards;
00229     // Our won cards 
00230     QList<int>   mWonCards;
00231     // Our points 
00232     int mPoints;
00233     // Our id 
00234     int mId;
00235     // Number of moves won in the current game 
00236     int mMovesWon;
00237     // The current trump 
00238     Suite mTrump;
00239 
00240     // These attributes need to be saved
00241     // Our name
00242     QString mName;
00243     // Overall games won for this player 
00244     int mGamesWon;
00245     // Overall score for this player 
00246     int mScore;
00247     // Overall number of games for this player 
00248     int mNumberOfGames;
00249 };
00250 
00251 #endif

Generated on Tue May 1 09:34:40 2007 for LSkat by  doxygen 1.4.6