summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/solitaire/patiencecardgame.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/noncore/games/solitaire/patiencecardgame.cpp b/noncore/games/solitaire/patiencecardgame.cpp
index 1501d2f..fc91b26 100644
--- a/noncore/games/solitaire/patiencecardgame.cpp
+++ b/noncore/games/solitaire/patiencecardgame.cpp
@@ -149,96 +149,99 @@ void PatienceCardGame::readConfig( Config& cfg )
149 readPile( cfg, faceUpDealingPile, "FaceUpDealingPile", highestZ ); 149 readPile( cfg, faceUpDealingPile, "FaceUpDealingPile", highestZ );
150 150
151 highestZ++; 151 highestZ++;
152 152
153 endDealing(); 153 endDealing();
154} 154}
155 155
156 156
157void PatienceCardGame::writeConfig( Config& cfg ) 157void PatienceCardGame::writeConfig( Config& cfg )
158{ 158{
159 cfg.setGroup("GameState"); 159 cfg.setGroup("GameState");
160 cfg.writeEntry("numberOfTimesThroughDeck", numberOfTimesThroughDeck); 160 cfg.writeEntry("numberOfTimesThroughDeck", numberOfTimesThroughDeck);
161 161
162 for ( int i = 0; i < 7; i++ ) { 162 for ( int i = 0; i < 7; i++ ) {
163 QString pile; 163 QString pile;
164 pile.sprintf( "WorkingPile%i", i ); 164 pile.sprintf( "WorkingPile%i", i );
165 workingPiles[i]->writeConfig( cfg, pile ); 165 workingPiles[i]->writeConfig( cfg, pile );
166 } 166 }
167 for ( int i = 0; i < 4; i++ ) { 167 for ( int i = 0; i < 4; i++ ) {
168 QString pile; 168 QString pile;
169 pile.sprintf( "DiscardPile%i", i ); 169 pile.sprintf( "DiscardPile%i", i );
170 discardPiles[i]->writeConfig( cfg, pile ); 170 discardPiles[i]->writeConfig( cfg, pile );
171 } 171 }
172 faceDownDealingPile->writeConfig( cfg, "FaceDownDealingPile" ); 172 faceDownDealingPile->writeConfig( cfg, "FaceDownDealingPile" );
173 faceUpDealingPile->writeConfig( cfg, "FaceUpDealingPile" ); 173 faceUpDealingPile->writeConfig( cfg, "FaceUpDealingPile" );
174} 174}
175 175
176 176
177bool PatienceCardGame::mousePressCard( Card *card, QPoint p ) 177bool PatienceCardGame::mousePressCard( Card *card, QPoint p )
178{ 178{
179 Q_UNUSED(p); 179 Q_UNUSED(p);
180 180
181 CanvasCard *item = (CanvasCard *)card; 181 CanvasCard *item = (CanvasCard *)card;
182 if (item->isFacing() != TRUE) { 182 if (item->isFacing() != TRUE) {
183 // From facedown stack 183 // From facedown stack
184 if ((item->x() == 5) && ((int)item->y() == 10)) { 184 if ((item->x() == 5) && ((int)item->y() == 10)) {
185 item->setZ(highestZ); 185 item->setZ(highestZ);
186 highestZ++; 186 highestZ++;
187 187
188 // Added Code 188 // Added Code
189 faceDownDealingPile->removeCard(item); 189 faceDownDealingPile->removeCard(item);
190 faceUpDealingPile->addCardToTop(item); 190 faceUpDealingPile->addCardToTop(item);
191 item->setCardPile( faceUpDealingPile ); 191 item->setCardPile( faceUpDealingPile );
192 192
193 if ( qt_screen->deviceWidth() < 200 ) 193 if ( qt_screen->deviceWidth() < 200 )
194 item->flipTo( 30, (int)item->y() ); 194 item->flipTo( 30, (int)item->y() );
195 else 195 else
196 item->flipTo( 35, (int)item->y() ); 196 item->flipTo( 35, (int)item->y() );
197 } else {
198 // fix from cmader by tille
199 return false;
197 } 200 }
198 moving = NULL; 201 moving = NULL;
199 moved = FALSE; 202 moved = FALSE;
200 203
201 // move two other cards if we flip three at a time 204 // move two other cards if we flip three at a time
202 int flipped = 1; 205 int flipped = 1;
203 QCanvasItemList l = canvas()->collisions( p ); 206 QCanvasItemList l = canvas()->collisions( p );
204 for (QCanvasItemList::Iterator it = l.begin(); (it != l.end()) && (flipped != cardsDrawn()); ++it) { 207 for (QCanvasItemList::Iterator it = l.begin(); (it != l.end()) && (flipped != cardsDrawn()); ++it) {
205 if ( (*it)->rtti() == canvasCardId ) { 208 if ( (*it)->rtti() == canvasCardId ) {
206 CanvasCard *item = (CanvasCard *)*it; 209 CanvasCard *item = (CanvasCard *)*it;
207 if (item->animated()) 210 if (item->animated())
208 continue; 211 continue;
209 item->setZ(highestZ); 212 item->setZ(highestZ);
210 highestZ++; 213 highestZ++;
211 flipped++; 214 flipped++;
212 215
213 // Added Code 216 // Added Code
214 faceDownDealingPile->removeCard(item); 217 faceDownDealingPile->removeCard(item);
215 faceUpDealingPile->addCardToTop(item); 218 faceUpDealingPile->addCardToTop(item);
216 item->setCardPile( faceUpDealingPile ); 219 item->setCardPile( faceUpDealingPile );
217 220
218 if ( qt_screen->deviceWidth() < 200 ) 221 if ( qt_screen->deviceWidth() < 200 )
219 item->flipTo( 30, (int)item->y(), 8 * flipped ); 222 item->flipTo( 30, (int)item->y(), 8 * flipped );
220 else 223 else
221 item->flipTo( 35, (int)item->y(), 8 * flipped ); 224 item->flipTo( 35, (int)item->y(), 8 * flipped );
222 } 225 }
223 } 226 }
224 227
225 return TRUE; 228 return TRUE;
226 } 229 }
227 230
228 return FALSE; 231 return FALSE;
229} 232}
230 233
231 234
232void PatienceCardGame::mousePress(QPoint p) 235void PatienceCardGame::mousePress(QPoint p)
233{ 236{
234 if ( canTurnOverDeck() && 237 if ( canTurnOverDeck() &&
235 (p.x() > 5) && (p.x() < 28) && 238 (p.x() > 5) && (p.x() < 28) &&
236 (p.y() > 10) && (p.y() < 46) ) { 239 (p.y() > 10) && (p.y() < 46) ) {
237 240
238 beginDealing(); 241 beginDealing();
239 Card *card = faceUpDealingPile->cardOnTop(); 242 Card *card = faceUpDealingPile->cardOnTop();
240 while ( card ) { 243 while ( card ) {
241 card->setPos( 5, 10, highestZ ); 244 card->setPos( 5, 10, highestZ );
242 card->setFace( FALSE ); 245 card->setFace( FALSE );
243 faceUpDealingPile->removeCard( card ); 246 faceUpDealingPile->removeCard( card );
244 faceDownDealingPile->addCardToTop( card ); 247 faceDownDealingPile->addCardToTop( card );