summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/games/solitaire/patiencecardgame.cpp66
1 files changed, 44 insertions, 22 deletions
diff --git a/noncore/games/solitaire/patiencecardgame.cpp b/noncore/games/solitaire/patiencecardgame.cpp
index 1b38072..96a599c 100644
--- a/noncore/games/solitaire/patiencecardgame.cpp
+++ b/noncore/games/solitaire/patiencecardgame.cpp
@@ -31,3 +31,4 @@ PatienceCardGame::PatienceCardGame(QCanvas *c, bool snap, QWidget *parent) : Can
31 31
32 if ( qt_screen->deviceWidth() < 200 ) { 32 if ( qt_screen->deviceWidth() < 200 )
33 {
33 circleCross = new CanvasCircleOrCross( 7, 16, canvas() ); 34 circleCross = new CanvasCircleOrCross( 7, 16, canvas() );
@@ -35,3 +36,4 @@ PatienceCardGame::PatienceCardGame(QCanvas *c, bool snap, QWidget *parent) : Can
35 36
36 for (int i = 0; i < 4; i++) { 37 for (int i = 0; i < 4; i++)
38 {
37 discardPiles[i] = new PatienceDiscardPile( 78 + i * 23, 10, canvas() ); 39 discardPiles[i] = new PatienceDiscardPile( 78 + i * 23, 10, canvas() );
@@ -39,3 +41,4 @@ PatienceCardGame::PatienceCardGame(QCanvas *c, bool snap, QWidget *parent) : Can
39 } 41 }
40 for (int i = 0; i < 7; i++) { 42 for (int i = 0; i < 7; i++)
43 {
41 workingPiles[i] = new PatienceWorkingPile( 5 + i * 23, 50, canvas() ); 44 workingPiles[i] = new PatienceWorkingPile( 5 + i * 23, 50, canvas() );
@@ -45,3 +48,5 @@ PatienceCardGame::PatienceCardGame(QCanvas *c, bool snap, QWidget *parent) : Can
45 faceUpDealingPile = new PatienceFaceUpDeck( 30, 10, canvas() ); 48 faceUpDealingPile = new PatienceFaceUpDeck( 30, 10, canvas() );
46 } else { 49 }
50 else
51 {
47 circleCross = new CanvasCircleOrCross( 7, 18, canvas() ); 52 circleCross = new CanvasCircleOrCross( 7, 18, canvas() );
@@ -49,3 +54,4 @@ PatienceCardGame::PatienceCardGame(QCanvas *c, bool snap, QWidget *parent) : Can
49 54
50 for (int i = 0; i < 4; i++) { 55 for (int i = 0; i < 4; i++)
56 {
51 discardPiles[i] = new PatienceDiscardPile( 110 + i * 30, 10, canvas() ); 57 discardPiles[i] = new PatienceDiscardPile( 110 + i * 30, 10, canvas() );
@@ -53,3 +59,4 @@ PatienceCardGame::PatienceCardGame(QCanvas *c, bool snap, QWidget *parent) : Can
53 } 59 }
54 for (int i = 0; i < 7; i++) { 60 for (int i = 0; i < 7; i++)
61 {
55 workingPiles[i] = new PatienceWorkingPile( 10 + i * 30, 50, canvas() ); 62 workingPiles[i] = new PatienceWorkingPile( 10 + i * 30, 50, canvas() );
@@ -79,5 +86,7 @@ void PatienceCardGame::deal(void)
79 86
80 for (int i = 0; i < 7; i++) { 87 for (int i = 0; i < 7; i++)
88 {
81 cards[t]->setFace(TRUE); 89 cards[t]->setFace(TRUE);
82 for (int k = i; k < 7; k++, t++) { 90 for (int k = i; k < 7; k++, t++)
91 {
83 Card *card = cards[t]; 92 Card *card = cards[t];
@@ -92,3 +101,4 @@ void PatienceCardGame::deal(void)
92 101
93 for ( ; t < 52; t++) { 102 for ( ; t < 52; t++)
103 {
94 Card *card = cards[t]; 104 Card *card = cards[t];
@@ -111,3 +121,4 @@ void PatienceCardGame::readConfig( Config& cfg )
111 // Do we have a config file to read in? 121 // Do we have a config file to read in?
112 if ( !cfg.hasKey("numberOfTimesThroughDeck") ) { 122 if ( !cfg.hasKey("numberOfTimesThroughDeck") )
123 {
113 // if not, create a new game 124 // if not, create a new game
@@ -122,3 +133,3 @@ void PatienceCardGame::readConfig( Config& cfg )
122 // How many times through the deck have we been 133 // How many times through the deck have we been
123 numberOfTimesThroughDeck = cfg.readNumEntry("NumberOfTimesThroughDeck"); 134 numberOfTimesThroughDeck = cfg.readNumEntry("numberOfTimesThroughDeck");
124 135
@@ -135,3 +146,4 @@ void PatienceCardGame::readConfig( Config& cfg )
135 146
136 for (int k = 0; k < 7; k++) { 147 for (int k = 0; k < 7; k++)
148 {
137 QString pile; 149 QString pile;
@@ -141,3 +153,4 @@ void PatienceCardGame::readConfig( Config& cfg )
141 153
142 for (int k = 0; k < 4; k++) { 154 for (int k = 0; k < 4; k++)
155 {
143 QString pile; 156 QString pile;
@@ -161,3 +174,4 @@ void PatienceCardGame::writeConfig( Config& cfg )
161 174
162 for ( int i = 0; i < 7; i++ ) { 175 for ( int i = 0; i < 7; i++ )
176 {
163 QString pile; 177 QString pile;
@@ -166,3 +180,4 @@ void PatienceCardGame::writeConfig( Config& cfg )
166 } 180 }
167 for ( int i = 0; i < 4; i++ ) { 181 for ( int i = 0; i < 4; i++ )
182 {
168 QString pile; 183 QString pile;
@@ -181,5 +196,7 @@ bool PatienceCardGame::mousePressCard( Card *card, QPoint p )
181 CanvasCard *item = (CanvasCard *)card; 196 CanvasCard *item = (CanvasCard *)card;
182 if (item->isFacing() != TRUE) { 197 if (item->isFacing() != TRUE)
198 {
183 // From facedown stack 199 // From facedown stack
184 if ((item->x() == 5) && ((int)item->y() == 10)) { 200 if ((item->x() == 5) && ((int)item->y() == 10))
201 {
185 item->setZ(highestZ); 202 item->setZ(highestZ);
@@ -196,3 +213,4 @@ bool PatienceCardGame::mousePressCard( Card *card, QPoint p )
196 item->flipTo( 35, (int)item->y() ); 213 item->flipTo( 35, (int)item->y() );
197 } else return FALSE; // <- was missing, caused facedown card to react 214 }
215 else return FALSE; // <- was missing, caused facedown card to react
198 // to clicking, which is wrong 216 // to clicking, which is wrong
@@ -204,4 +222,6 @@ bool PatienceCardGame::mousePressCard( Card *card, QPoint p )
204 QCanvasItemList l = canvas()->collisions( p ); 222 QCanvasItemList l = canvas()->collisions( p );
205 for (QCanvasItemList::Iterator it = l.begin(); (it != l.end()) && (flipped != cardsDrawn()); ++it) { 223 for (QCanvasItemList::Iterator it = l.begin(); (it != l.end()) && (flipped != cardsDrawn()); ++it)
206 if ( (*it)->rtti() == canvasCardId ) { 224 {
225 if ( (*it)->rtti() == canvasCardId )
226 {
207 CanvasCard *item = (CanvasCard *)*it; 227 CanvasCard *item = (CanvasCard *)*it;
@@ -236,3 +256,4 @@ void PatienceCardGame::mousePress(QPoint p)
236 (p.x() > 5) && (p.x() < 28) && 256 (p.x() > 5) && (p.x() < 28) &&
237 (p.y() > 10) && (p.y() < 46) ) { 257 (p.y() > 10) && (p.y() < 46) )
258 {
238 259
@@ -240,3 +261,4 @@ void PatienceCardGame::mousePress(QPoint p)
240 Card *card = faceUpDealingPile->cardOnTop(); 261 Card *card = faceUpDealingPile->cardOnTop();
241 while ( card ) { 262 while ( card )
263 {
242 card->setPos( 5, 10, highestZ ); 264 card->setPos( 5, 10, highestZ );