summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/solitaire/patiencecardgame.cpp13
-rw-r--r--noncore/games/solitaire/patiencecardgame.h31
2 files changed, 25 insertions, 19 deletions
diff --git a/noncore/games/solitaire/patiencecardgame.cpp b/noncore/games/solitaire/patiencecardgame.cpp
index 756577a..a1e4968 100644
--- a/noncore/games/solitaire/patiencecardgame.cpp
+++ b/noncore/games/solitaire/patiencecardgame.cpp
@@ -117,9 +117,9 @@ void PatienceCardGame::readConfig( Config& cfg )
117{ 117{
118 cfg.setGroup("GameState"); 118 cfg.setGroup("GameState");
119 119
120 deckTurns = cfg.readNumEntry("DeckTurns", 2500);
120 // Do we have a config file to read in? 121 // Do we have a config file to read in?
121 if ( !cfg.hasKey("numberOfTimesThroughDeck") ) 122 if ( !cfg.hasKey("numberOfTimesThroughDeck") ) {
122 {
123 // if not, create a new game 123 // if not, create a new game
124 newGame(); 124 newGame();
125 return; 125 return;
@@ -277,3 +277,12 @@ void PatienceCardGame::mousePress(QPoint p)
277} 277}
278 278
279 279
280bool PatienceCardGame::canTurnOverDeck() {
281 return (numberOfTimesThroughDeck != deckTurns);
282}
283
284void PatienceCardGame::throughDeck() {
285 numberOfTimesThroughDeck++;
286 if (numberOfTimesThroughDeck == deckTurns)
287 circleCross->setCross();
288 }
diff --git a/noncore/games/solitaire/patiencecardgame.h b/noncore/games/solitaire/patiencecardgame.h
index 0d0e3d5..b76251a 100644
--- a/noncore/games/solitaire/patiencecardgame.h
+++ b/noncore/games/solitaire/patiencecardgame.h
@@ -18,7 +18,7 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef PATIENCE_CARD_GAME_H 20#ifndef PATIENCE_CARD_GAME_H
21#define PATIENCE_CARD_GAME_H 21#define PATIENCE_CARD_GAME_H
22 22
23 23
24#include <qpopupmenu.h> 24#include <qpopupmenu.h>
@@ -46,7 +46,7 @@ public:
46 //if ( ( !card->isFacing() ) && ( card == cardOnTop() ) ) 46 //if ( ( !card->isFacing() ) && ( card == cardOnTop() ) )
47 if ( card == cardOnTop() ) 47 if ( card == cardOnTop() )
48 return TRUE; 48 return TRUE;
49 return FALSE; 49 return FALSE;
50 } 50 }
51}; 51};
52 52
@@ -66,7 +66,7 @@ public:
66 //if ( ( card->isFacing() ) && ( card == cardOnTop() ) ) 66 //if ( ( card->isFacing() ) && ( card == cardOnTop() ) )
67 if ( card == cardOnTop() ) 67 if ( card == cardOnTop() )
68 return TRUE; 68 return TRUE;
69 return FALSE; 69 return FALSE;
70 } 70 }
71}; 71};
72 72
@@ -83,12 +83,12 @@ public:
83 ( (int)card->getValue() == (int)cardOnTop()->getValue() + 1 ) && 83 ( (int)card->getValue() == (int)cardOnTop()->getValue() + 1 ) &&
84 ( card->getSuit() == cardOnTop()->getSuit() ) ) ) ) 84 ( card->getSuit() == cardOnTop()->getSuit() ) ) ) )
85 return TRUE; 85 return TRUE;
86 return FALSE; 86 return FALSE;
87 } 87 }
88 virtual bool isAllowedToBeMoved(Card *card) { 88 virtual bool isAllowedToBeMoved(Card *card) {
89 if ( card->isFacing() && ( card == cardOnTop() ) ) 89 if ( card->isFacing() && ( card == cardOnTop() ) )
90 return TRUE; 90 return TRUE;
91 return FALSE; 91 return FALSE;
92 } 92 }
93}; 93};
94 94
@@ -105,12 +105,12 @@ public:
105 ( (int)card->getValue() + 1 == (int)cardOnTop()->getValue() ) && 105 ( (int)card->getValue() + 1 == (int)cardOnTop()->getValue() ) &&
106 ( card->isRed() != cardOnTop()->isRed() ) ) ) ) 106 ( card->isRed() != cardOnTop()->isRed() ) ) ) )
107 return TRUE; 107 return TRUE;
108 return FALSE; 108 return FALSE;
109 } 109 }
110 virtual bool isAllowedToBeMoved(Card *card) { 110 virtual bool isAllowedToBeMoved(Card *card) {
111 if ( card->isFacing() ) 111 if ( card->isFacing() )
112 return TRUE; 112 return TRUE;
113 return FALSE; 113 return FALSE;
114 } 114 }
115 virtual void cardAddedToTop(Card *card) { 115 virtual void cardAddedToTop(Card *card) {
116 Q_UNUSED(card); 116 Q_UNUSED(card);
@@ -148,12 +148,12 @@ public:
148 while ((card != c) && (card != NULL)) { 148 while ((card != c) && (card != NULL)) {
149 if (card->isFacing()) { 149 if (card->isFacing()) {
150 int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13; 150 int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13;
151 y += offsetDown; 151 y += offsetDown;
152 } else { 152 } else {
153 x += 1; 153 x += 1;
154 y += 3; 154 y += 3;
155 } 155 }
156 card = cardInfront(card); 156 card = cardInfront(card);
157 } 157 }
158 return QPoint( x, y ); 158 return QPoint( x, y );
159 } 159 }
@@ -173,7 +173,8 @@ public:
173 PatienceCardGame(QCanvas *c, bool snap, QWidget *parent = 0); 173 PatienceCardGame(QCanvas *c, bool snap, QWidget *parent = 0);
174 virtual ~PatienceCardGame(); 174 virtual ~PatienceCardGame();
175 virtual void deal(void); 175 virtual void deal(void);
176 virtual bool haveWeWon() { 176 int deckTurns;
177 virtual bool haveWeWon() {
177 return ( discardPiles[0]->kingOnTop() && 178 return ( discardPiles[0]->kingOnTop() &&
178 discardPiles[1]->kingOnTop() && 179 discardPiles[1]->kingOnTop() &&
179 discardPiles[2]->kingOnTop() && 180 discardPiles[2]->kingOnTop() &&
@@ -185,12 +186,8 @@ public:
185 virtual bool mousePressCard(Card *card, QPoint p); 186 virtual bool mousePressCard(Card *card, QPoint p);
186 virtual void mouseReleaseCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); } 187 virtual void mouseReleaseCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); }
187// virtual void mouseMoveCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); } 188// virtual void mouseMoveCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); }
188 bool canTurnOverDeck(void) { return (numberOfTimesThroughDeck != 3); } 189 bool canTurnOverDeck();
189 void throughDeck(void) { 190 void throughDeck();
190 numberOfTimesThroughDeck++;
191 if (numberOfTimesThroughDeck == 3)
192 circleCross->setCross();
193 }
194 bool snapOn; 191 bool snapOn;
195 virtual void writeConfig( Config& cfg ); 192 virtual void writeConfig( Config& cfg );
196 virtual void readConfig( Config& cfg ); 193 virtual void readConfig( Config& cfg );