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
@@ -118,7 +118,7 @@ void PatienceCardGame::readConfig( Config& cfg )
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();
@@ -278,2 +278,11 @@ void PatienceCardGame::mousePress(QPoint p)
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
@@ -19,5 +19,5 @@
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
@@ -47,5 +47,5 @@ public:
47 if ( card == cardOnTop() ) 47 if ( card == cardOnTop() )
48 return TRUE; 48 return TRUE;
49 return FALSE; 49 return FALSE;
50 } 50 }
51}; 51};
@@ -67,5 +67,5 @@ public:
67 if ( card == cardOnTop() ) 67 if ( card == cardOnTop() )
68 return TRUE; 68 return TRUE;
69 return FALSE; 69 return FALSE;
70 } 70 }
71}; 71};
@@ -84,10 +84,10 @@ public:
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};
@@ -106,10 +106,10 @@ public:
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) {
@@ -149,10 +149,10 @@ public:
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 );
@@ -174,5 +174,6 @@ public:
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() &&
@@ -186,10 +187,6 @@ public:
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 );