summaryrefslogtreecommitdiff
path: root/noncore/games/oyatzee/oyatzee.h
Side-by-side diff
Diffstat (limited to 'noncore/games/oyatzee/oyatzee.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/oyatzee/oyatzee.h98
1 files changed, 71 insertions, 27 deletions
diff --git a/noncore/games/oyatzee/oyatzee.h b/noncore/games/oyatzee/oyatzee.h
index 1074f1d..048a733 100644
--- a/noncore/games/oyatzee/oyatzee.h
+++ b/noncore/games/oyatzee/oyatzee.h
@@ -6,2 +6,4 @@
#include <qlist.h>
+#include <qmap.h>
+#include <qsplitter.h>
@@ -17,2 +19,4 @@ class Player;
+class QPoint;
+
typedef QList<Dice> dicesList;
@@ -21,2 +25,3 @@ typedef QValueList<int> QValueListInt;
typedef QList<Player> playerList;
+typedef QMap<int,int> pointMap;
@@ -28,3 +33,3 @@ class OYatzee : public QMainWindow {
- Game *g;
+ Game *g();
DiceWidget *dw;
@@ -33,2 +38,3 @@ class OYatzee : public QMainWindow {
QValueListInt posibilities;
+ playerList ps;
@@ -37,4 +43,3 @@ class OYatzee : public QMainWindow {
- enum {
- Ones=1,
+ enum { Ones = 1,
Twos = 2,
@@ -44,9 +49,9 @@ class OYatzee : public QMainWindow {
Sixes = 6,
- ThreeOfAKind = 7, //12444
- FourOfAKind = 8, //14444
- FullHouse = 9, //22555
- SStraight = 10, //13456
- LStraight = 11, //12345
- Yatzee = 12, //55555
- Chance = 13};
+ ThreeOfAKind = 9, //12444
+ FourOfAKind = 10, //14444
+ FullHouse = 11, //22555
+ SStraight = 12, //13456
+ LStraight = 13, //12345
+ Yatzee = 14, //55555
+ Chance = 15};
@@ -55,2 +60,3 @@ class OYatzee : public QMainWindow {
void slotRollDices();
+ void slotEndRound( int );
@@ -59,2 +65,9 @@ class OYatzee : public QMainWindow {
int numOfRounds;
+ int currentPlayer; /* the number of the current player */
+
+ int oakPoints;
+
+ void nextPlayer();
+
+ bool lastPlayerFinished;
@@ -66,2 +79,7 @@ class OYatzee : public QMainWindow {
+ int getPoints( const int , QValueListInt );
+
+ void startGame();
+ void stopGame();
+
};
@@ -74,8 +92,9 @@ class Dice : public QFrame
- int Value;
bool isSelected;
- int hasValue();
+ const int hasValue() const;
void roll();
- virtual void mousePressEvent( QMouseEvent* );
+
+ private:
+ int Value;
@@ -88,4 +107,5 @@ class Dice : public QFrame
protected:
- void paintEvent( QPaintEvent *e );
+ void paintEvent( QPaintEvent *e );
void paintNumber( QPainter *p );
+ virtual void mousePressEvent( QMouseEvent* );
};
@@ -103,3 +123,2 @@ class DiceWidget : public QWidget
-
class Board : public QWidget
@@ -109,2 +128,9 @@ class Board : public QWidget
Board( QWidget *parent = 0, const char* name = 0 );
+
+ signals:
+ void clicked( QPoint );
+ void item( int );
+
+ protected:
+ virtual void mousePressEvent( QMouseEvent* );
};
@@ -117,5 +143,17 @@ class Possibilityboard : public Board
Possibilityboard( QWidget *parent = 0, const char* name = 0 );
+
+ QValueListInt list;
+ void setIntlist( QValueListInt& );
+ private:
+ QStringList begriffe;
+
+ private slots:
+ /*
+ * this slot returns the item the user has selected
+ */
+ virtual void slotClicked(QPoint);
+
protected:
- virtual void paintEvent( QPaintEvent *e );
+ virtual void paintEvent( QPaintEvent *e );
};
@@ -127,5 +165,9 @@ class Resultboard : public Board
public:
- Resultboard( QString playerName , QWidget *parent = 0, const char* name = 0 );
+ Resultboard( QString playerName = 0 , QWidget *parent = 0, const char* name = 0 );
QString pName;
+ pointMap pMap;
+
+ void updateMap( int, int );
+
protected:
@@ -144,4 +186,7 @@ class Scoreboard : public QWidget
playerList ps_;
-
+
void createResultboards(const int);
+
+ Resultboard* nextRB(int);
+
@@ -159,14 +204,13 @@ class Player
int totalPoints;
-};
-class Game
-{
- public:
- Game( playerList pla );
+ void setResults( const int , const int );
- playerList players;
- int currentPlayer;
+ int turn;
- void startGame();
- void stopGame();
+ void updateTotalPoints( QMap<int,int> );
+
+ private:
+ QValueListInt pResults; /* the individual results of the player */
+
+ void setupResultList(); /* only in the ctor */
};