author | llornkcor <llornkcor> | 2004-04-26 10:24:35 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-04-26 10:24:35 (UTC) |
commit | f6a98984fcb0dfc7e176636560b7cc1adacf38f2 (patch) (unidiff) | |
tree | f358b16531551035a54c1dac95e16a36f86f8dc9 /noncore | |
parent | 57d7f3faf053786925d2315e43ab6ba8d892f51a (diff) | |
download | opie-f6a98984fcb0dfc7e176636560b7cc1adacf38f2.zip opie-f6a98984fcb0dfc7e176636560b7cc1adacf38f2.tar.gz opie-f6a98984fcb0dfc7e176636560b7cc1adacf38f2.tar.bz2 |
turn off silly casino rules solitare
-rw-r--r-- | noncore/games/solitaire/patiencecardgame.cpp | 13 | ||||
-rw-r--r-- | noncore/games/solitaire/patiencecardgame.h | 9 |
2 files changed, 14 insertions, 8 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 | |||
@@ -96,51 +96,51 @@ void PatienceCardGame::deal(void) | |||
96 | card->showCard(); | 96 | card->showCard(); |
97 | highestZ++; | 97 | highestZ++; |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | for ( ; t < 52; t++) | 101 | for ( ; t < 52; t++) |
102 | { | 102 | { |
103 | Card *card = cards[t]; | 103 | Card *card = cards[t]; |
104 | faceDownDealingPile->addCardToTop(card); | 104 | faceDownDealingPile->addCardToTop(card); |
105 | card->setCardPile( faceDownDealingPile ); | 105 | card->setCardPile( faceDownDealingPile ); |
106 | QPoint p = faceDownDealingPile->getCardPos( card ); | 106 | QPoint p = faceDownDealingPile->getCardPos( card ); |
107 | card->setPos( p.x(), p.y(), highestZ ); | 107 | card->setPos( p.x(), p.y(), highestZ ); |
108 | card->showCard(); | 108 | card->showCard(); |
109 | highestZ++; | 109 | highestZ++; |
110 | } | 110 | } |
111 | 111 | ||
112 | endDealing(); | 112 | endDealing(); |
113 | } | 113 | } |
114 | 114 | ||
115 | 115 | ||
116 | void PatienceCardGame::readConfig( Config& cfg ) | 116 | 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; |
126 | } | 126 | } |
127 | // We have a config file, lets read it in and use it | 127 | // We have a config file, lets read it in and use it |
128 | 128 | ||
129 | // Create Cards, but don't shuffle or deal them yet | 129 | // Create Cards, but don't shuffle or deal them yet |
130 | createDeck(); | 130 | createDeck(); |
131 | 131 | ||
132 | // How many times through the deck have we been | 132 | // How many times through the deck have we been |
133 | numberOfTimesThroughDeck = cfg.readNumEntry("numberOfTimesThroughDeck"); | 133 | numberOfTimesThroughDeck = cfg.readNumEntry("numberOfTimesThroughDeck"); |
134 | 134 | ||
135 | // restore state to the circle/cross under the dealing pile | 135 | // restore state to the circle/cross under the dealing pile |
136 | if ( canTurnOverDeck() ) | 136 | if ( canTurnOverDeck() ) |
137 | circleCross->setCircle(); | 137 | circleCross->setCircle(); |
138 | else | 138 | else |
139 | circleCross->setCross(); | 139 | circleCross->setCross(); |
140 | 140 | ||
141 | // Move the cards to their piles (deal them to their previous places) | 141 | // Move the cards to their piles (deal them to their previous places) |
142 | beginDealing(); | 142 | beginDealing(); |
143 | 143 | ||
144 | highestZ = 1; | 144 | highestZ = 1; |
145 | 145 | ||
146 | for (int k = 0; k < 7; k++) | 146 | for (int k = 0; k < 7; k++) |
@@ -256,24 +256,33 @@ void PatienceCardGame::mousePress(QPoint p) | |||
256 | (p.y() > 10) && (p.y() < 46) ) | 256 | (p.y() > 10) && (p.y() < 46) ) |
257 | { | 257 | { |
258 | 258 | ||
259 | beginDealing(); | 259 | beginDealing(); |
260 | Card *card = faceUpDealingPile->cardOnTop(); | 260 | Card *card = faceUpDealingPile->cardOnTop(); |
261 | while ( card ) | 261 | while ( card ) |
262 | { | 262 | { |
263 | card->setPos( 5, 10, highestZ ); | 263 | card->setPos( 5, 10, highestZ ); |
264 | card->setFace( FALSE ); | 264 | card->setFace( FALSE ); |
265 | faceUpDealingPile->removeCard( card ); | 265 | faceUpDealingPile->removeCard( card ); |
266 | faceDownDealingPile->addCardToTop( card ); | 266 | faceDownDealingPile->addCardToTop( card ); |
267 | card->setCardPile( faceDownDealingPile ); | 267 | card->setCardPile( faceDownDealingPile ); |
268 | card = faceUpDealingPile->cardOnTop(); | 268 | card = faceUpDealingPile->cardOnTop(); |
269 | highestZ++; | 269 | highestZ++; |
270 | } | 270 | } |
271 | endDealing(); | 271 | endDealing(); |
272 | 272 | ||
273 | throughDeck(); | 273 | throughDeck(); |
274 | 274 | ||
275 | moved = TRUE; | 275 | moved = TRUE; |
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
279 | 279 | ||
280 | bool PatienceCardGame::canTurnOverDeck() { | ||
281 | return (numberOfTimesThroughDeck != deckTurns); | ||
282 | } | ||
283 | |||
284 | void 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 | |||
@@ -152,58 +152,55 @@ public: | |||
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 | } |
160 | virtual QPoint getHypertheticalNextCardPos(void) { | 160 | virtual QPoint getHypertheticalNextCardPos(void) { |
161 | return top; | 161 | return top; |
162 | // return QPoint( getNextX(), getNextY() ); | 162 | // return QPoint( getNextX(), getNextY() ); |
163 | } | 163 | } |
164 | private: | 164 | private: |
165 | QPoint top; | 165 | QPoint top; |
166 | 166 | ||
167 | }; | 167 | }; |
168 | 168 | ||
169 | 169 | ||
170 | class PatienceCardGame : public CanvasCardGame | 170 | class PatienceCardGame : public CanvasCardGame |
171 | { | 171 | { |
172 | public: | 172 | 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 | int deckTurns; | ||
176 | virtual bool haveWeWon() { | 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() && |
180 | discardPiles[3]->kingOnTop() );; | 181 | discardPiles[3]->kingOnTop() );; |
181 | } | 182 | } |
182 | virtual void mousePress(QPoint p); | 183 | virtual void mousePress(QPoint p); |
183 | virtual void mouseRelease(QPoint p) { Q_UNUSED(p); } | 184 | virtual void mouseRelease(QPoint p) { Q_UNUSED(p); } |
184 | // virtual void mouseMove(QPoint p); | 185 | // virtual void mouseMove(QPoint p); |
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 ); |
197 | private: | 194 | private: |
198 | CanvasCircleOrCross *circleCross; | 195 | CanvasCircleOrCross *circleCross; |
199 | CanvasRoundRect *rectangle; | 196 | CanvasRoundRect *rectangle; |
200 | PatienceWorkingPile *workingPiles[7]; | 197 | PatienceWorkingPile *workingPiles[7]; |
201 | PatienceDiscardPile *discardPiles[4]; | 198 | PatienceDiscardPile *discardPiles[4]; |
202 | PatienceFaceDownDeck *faceDownDealingPile; | 199 | PatienceFaceDownDeck *faceDownDealingPile; |
203 | PatienceFaceUpDeck *faceUpDealingPile; | 200 | PatienceFaceUpDeck *faceUpDealingPile; |
204 | int numberOfTimesThroughDeck; | 201 | int numberOfTimesThroughDeck; |
205 | }; | 202 | }; |
206 | 203 | ||
207 | 204 | ||
208 | #endif | 205 | #endif |
209 | 206 | ||