-rw-r--r-- | noncore/games/solitaire/patiencecardgame.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/noncore/games/solitaire/patiencecardgame.cpp b/noncore/games/solitaire/patiencecardgame.cpp index a1e4968..00448ad 100644 --- a/noncore/games/solitaire/patiencecardgame.cpp +++ b/noncore/games/solitaire/patiencecardgame.cpp | |||
@@ -8,24 +8,25 @@ | |||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | |||
20 | #include "patiencecardgame.h" | 21 | #include "patiencecardgame.h" |
21 | 22 | ||
22 | 23 | ||
23 | int highestZ = 0; | 24 | int highestZ = 0; |
24 | 25 | ||
25 | 26 | ||
26 | PatienceCardGame::PatienceCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent) | 27 | PatienceCardGame::PatienceCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent) |
27 | { | 28 | { |
28 | numberOfTimesThroughDeck = 0; | 29 | numberOfTimesThroughDeck = 0; |
29 | highestZ = 0; | 30 | highestZ = 0; |
30 | 31 | ||
31 | if ( qt_screen->deviceWidth() < 200 ) | 32 | if ( qt_screen->deviceWidth() < 200 ) |
@@ -108,27 +109,29 @@ void PatienceCardGame::deal(void) | |||
108 | card->showCard(); | 109 | card->showCard(); |
109 | highestZ++; | 110 | highestZ++; |
110 | } | 111 | } |
111 | 112 | ||
112 | endDealing(); | 113 | endDealing(); |
113 | } | 114 | } |
114 | 115 | ||
115 | 116 | ||
116 | void PatienceCardGame::readConfig( Config& cfg ) | 117 | void PatienceCardGame::readConfig( Config& cfg ) |
117 | { | 118 | { |
118 | cfg.setGroup("GameState"); | 119 | cfg.setGroup("GameState"); |
119 | 120 | ||
120 | deckTurns = cfg.readNumEntry("DeckTurns", 2500); | 121 | // todo: make this eventually configurable |
122 | deckTurns = cfg.readNumEntry("DeckTurns", 2); | ||
121 | // Do we have a config file to read in? | 123 | // Do we have a config file to read in? |
122 | if ( !cfg.hasKey("numberOfTimesThroughDeck") ) { | 124 | if ( !cfg.hasKey("numberOfTimesThroughDeck") ) |
125 | { | ||
123 | // if not, create a new game | 126 | // if not, create a new game |
124 | newGame(); | 127 | newGame(); |
125 | return; | 128 | return; |
126 | } | 129 | } |
127 | // We have a config file, lets read it in and use it | 130 | // We have a config file, lets read it in and use it |
128 | 131 | ||
129 | // Create Cards, but don't shuffle or deal them yet | 132 | // Create Cards, but don't shuffle or deal them yet |
130 | createDeck(); | 133 | createDeck(); |
131 | 134 | ||
132 | // How many times through the deck have we been | 135 | // How many times through the deck have we been |
133 | numberOfTimesThroughDeck = cfg.readNumEntry("numberOfTimesThroughDeck"); | 136 | numberOfTimesThroughDeck = cfg.readNumEntry("numberOfTimesThroughDeck"); |
134 | 137 | ||
@@ -267,22 +270,23 @@ void PatienceCardGame::mousePress(QPoint p) | |||
267 | card->setCardPile( faceDownDealingPile ); | 270 | card->setCardPile( faceDownDealingPile ); |
268 | card = faceUpDealingPile->cardOnTop(); | 271 | card = faceUpDealingPile->cardOnTop(); |
269 | highestZ++; | 272 | highestZ++; |
270 | } | 273 | } |
271 | endDealing(); | 274 | endDealing(); |
272 | 275 | ||
273 | throughDeck(); | 276 | throughDeck(); |
274 | 277 | ||
275 | moved = TRUE; | 278 | moved = TRUE; |
276 | } | 279 | } |
277 | } | 280 | } |
278 | 281 | ||
279 | 282 | bool PatienceCardGame::canTurnOverDeck() | |
280 | bool PatienceCardGame::canTurnOverDeck() { | 283 | { |
281 | return (numberOfTimesThroughDeck != deckTurns); | 284 | return (numberOfTimesThroughDeck != deckTurns); |
282 | } | 285 | } |
283 | 286 | ||
284 | void PatienceCardGame::throughDeck() { | 287 | void PatienceCardGame::throughDeck() |
288 | { | ||
285 | numberOfTimesThroughDeck++; | 289 | numberOfTimesThroughDeck++; |
286 | if (numberOfTimesThroughDeck == deckTurns) | 290 | if (numberOfTimesThroughDeck == deckTurns) |
287 | circleCross->setCross(); | 291 | circleCross->setCross(); |
288 | } | 292 | } |