Diffstat (limited to 'noncore/games/solitaire/chicanecardgame.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/solitaire/chicanecardgame.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/noncore/games/solitaire/chicanecardgame.cpp b/noncore/games/solitaire/chicanecardgame.cpp index 6729a94..6c607b9 100644 --- a/noncore/games/solitaire/chicanecardgame.cpp +++ b/noncore/games/solitaire/chicanecardgame.cpp | |||
@@ -1,77 +1,76 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
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 | ** created on base of patiencecardgame by cam (C.A.Mader) 2002 | 20 | ** created on base of patiencecardgame by cam (C.A.Mader) 2002 |
21 | ** Rules for this game: | 21 | ** Rules for this game: |
22 | **use 2 decks = 104 cards | 22 | **use 2 decks = 104 cards |
23 | **deal 8 rows with 3 hidden cards and one open card | 23 | **deal 8 rows with 3 hidden cards and one open card |
24 | ** append red to black and vice versa | 24 | ** append red to black and vice versa |
25 | **each card can be layed on a free place | 25 | **each card can be layed on a free place |
26 | **deal 8 cards at once | 26 | **deal 8 cards at once |
27 | ** | 27 | ** |
28 | **********************************************************************/ | 28 | **********************************************************************/ |
29 | #include <qgfx_qws.h> | ||
30 | #include "chicanecardgame.h" | 29 | #include "chicanecardgame.h" |
31 | 30 | ||
32 | 31 | ||
33 | extern int highestZ; | 32 | extern int highestZ; |
34 | 33 | ||
35 | 34 | ||
36 | ChicaneCardGame::ChicaneCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent, 2)// Use 2 Decks | 35 | ChicaneCardGame::ChicaneCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent, 2)// Use 2 Decks |
37 | { | 36 | { |
38 | highestZ = 0; | 37 | highestZ = 0; |
39 | 38 | ||
40 | for (int i = 0; i < 8; i++) { | 39 | for (int i = 0; i < 8; i++) { |
41 | discardPiles[i] = new ChicaneDiscardPile( 27 + i * 26, 10, canvas() ); | 40 | discardPiles[i] = new ChicaneDiscardPile( 27 + i * 26, 10, canvas() ); |
42 | addCardPile(discardPiles[i]); | 41 | addCardPile(discardPiles[i]); |
43 | } | 42 | } |
44 | for (int i = 0; i < 8; i++) { | 43 | for (int i = 0; i < 8; i++) { |
45 | workingPiles[i] = new ChicaneWorkingPile( 27 + i * 26, 50, canvas() ); | 44 | workingPiles[i] = new ChicaneWorkingPile( 27 + i * 26, 50, canvas() ); |
46 | addCardPile(workingPiles[i]); | 45 | addCardPile(workingPiles[i]); |
47 | } | 46 | } |
48 | faceDownDealingPile = new ChicaneFaceDownDeck( 2, 10, canvas() ); | 47 | faceDownDealingPile = new ChicaneFaceDownDeck( 2, 10, canvas() ); |
49 | } | 48 | } |
50 | 49 | ||
51 | 50 | ||
52 | void ChicaneCardGame::deal(void) | 51 | void ChicaneCardGame::deal(void) |
53 | { | 52 | { |
54 | highestZ = 1; | 53 | highestZ = 1; |
55 | int t = 0; | 54 | int t = 0; |
56 | 55 | ||
57 | beginDealing(); | 56 | beginDealing(); |
58 | 57 | ||
59 | for (int i = 0; i < 8; i++) { | 58 | for (int i = 0; i < 8; i++) { |
60 | for (int k = 0; k < 4; k++, t++) { | 59 | for (int k = 0; k < 4; k++, t++) { |
61 | Card *card = cards[t]; | 60 | Card *card = cards[t]; |
62 | workingPiles[i]->addCardToTop(card); | 61 | workingPiles[i]->addCardToTop(card); |
63 | card->setCardPile( workingPiles[i] ); | 62 | card->setCardPile( workingPiles[i] ); |
64 | card->setPos( 0, 0, highestZ ); | 63 | card->setPos( 0, 0, highestZ ); |
65 | card->setFace(k==3); | 64 | card->setFace(k==3); |
66 | card->move( workingPiles[i]->getCardPos( card ) ); | 65 | card->move( workingPiles[i]->getCardPos( card ) ); |
67 | card->showCard(); | 66 | card->showCard(); |
68 | highestZ++; | 67 | highestZ++; |
69 | } | 68 | } |
70 | } | 69 | } |
71 | 70 | ||
72 | for ( ; t < getNumberOfCards(); t++) { | 71 | for ( ; t < getNumberOfCards(); t++) { |
73 | Card *card = cards[t]; | 72 | Card *card = cards[t]; |
74 | faceDownDealingPile->addCardToTop(card); | 73 | faceDownDealingPile->addCardToTop(card); |
75 | card->setCardPile( faceDownDealingPile ); | 74 | card->setCardPile( faceDownDealingPile ); |
76 | QPoint p = faceDownDealingPile->getCardPos( card ); | 75 | QPoint p = faceDownDealingPile->getCardPos( card ); |
77 | card->setPos( p.x(), p.y(), highestZ ); | 76 | card->setPos( p.x(), p.y(), highestZ ); |