author | tille <tille> | 2002-07-10 13:58:19 (UTC) |
---|---|---|
committer | tille <tille> | 2002-07-10 13:58:19 (UTC) |
commit | 6fefe6d5f0b7721e8f692ad8759666f3c50cd437 (patch) (unidiff) | |
tree | fa55166dba5b4366479a9c96c9efcc35a4ab7a02 | |
parent | dcf25882f9093a34571454ec7bb2ecb821575498 (diff) | |
download | opie-6fefe6d5f0b7721e8f692ad8759666f3c50cd437.zip opie-6fefe6d5f0b7721e8f692ad8759666f3c50cd437.tar.gz opie-6fefe6d5f0b7721e8f692ad8759666f3c50cd437.tar.bz2 |
tr(comments)
-rw-r--r-- | noncore/games/solitaire/canvascardgame.cpp | 4 | ||||
-rw-r--r-- | noncore/games/solitaire/chicanecardgame.cpp | 8 | ||||
-rw-r--r-- | noncore/games/solitaire/chicanecardgame.h | 17 | ||||
-rw-r--r-- | noncore/games/solitaire/harpcardgame.cpp | 10 | ||||
-rw-r--r-- | noncore/games/solitaire/harpcardgame.h | 18 | ||||
-rw-r--r-- | noncore/games/solitaire/teeclubcardgame.cpp | 12 | ||||
-rw-r--r-- | noncore/games/solitaire/teeclubcardgame.h | 27 |
7 files changed, 74 insertions, 22 deletions
diff --git a/noncore/games/solitaire/canvascardgame.cpp b/noncore/games/solitaire/canvascardgame.cpp index 4404b04..8e07cc8 100644 --- a/noncore/games/solitaire/canvascardgame.cpp +++ b/noncore/games/solitaire/canvascardgame.cpp | |||
@@ -362,26 +362,26 @@ void CanvasCardGame::contentsMouseReleaseEvent(QMouseEvent *e) | |||
362 | 362 | ||
363 | 363 | ||
364 | void CanvasCardGame::readPile( Config& cfg, CardPile *pile, QString name, int& highestZ ) | 364 | void CanvasCardGame::readPile( Config& cfg, CardPile *pile, QString name, int& highestZ ) |
365 | { | 365 | { |
366 | cfg.setGroup( name ); | 366 | cfg.setGroup( name ); |
367 | int numberOfCards = cfg.readNumEntry("NumberOfCards", 0); | 367 | int numberOfCards = cfg.readNumEntry("NumberOfCards", 0); |
368 | Card *card = NULL; | 368 | Card *card = NULL; |
369 | 369 | ||
370 | for ( int i = 0; i < numberOfCards; i++ ) { | 370 | for ( int i = 0; i < numberOfCards; i++ ) { |
371 | QString cardStr; | 371 | QString cardStr; |
372 | cardStr.sprintf( "%i", i ); | 372 | cardStr.sprintf( "%i", i ); |
373 | int val = cfg.readNumEntry( "Card" + cardStr ); | 373 | int val = cfg.readNumEntry( "Card" + cardStr ); |
374 | bool facing = cfg.readBoolEntry( "CardFacing" + cardStr ); | 374 | bool facing = cfg.readBoolEntry( "CardFacing" + cardStr ); |
375 | 375 | ||
376 | card = cards[ val ]; | 376 | card = cards[ val ]; |
377 | card->setFace(facing); | 377 | card->setFace(facing); |
378 | card->setCardPile(pile); // cam: setCardPile muss vor addCardToTop passieren | 378 | card->setCardPile(pile); // cam: setCardPile has to happen bevor addCardToTop |
379 | pile->addCardToTop(card); // weil sonst absturz wg cardAddedToTop | 379 | pile->addCardToTop(card); // due to a empty pointer if you use cardAddedToTop |
380 | QPoint p = pile->getCardPos( card ); | 380 | QPoint p = pile->getCardPos( card ); |
381 | card->setPos( p.x(), p.y(), highestZ ); | 381 | card->setPos( p.x(), p.y(), highestZ ); |
382 | card->showCard(); | 382 | card->showCard(); |
383 | highestZ++; | 383 | highestZ++; |
384 | } | 384 | } |
385 | } | 385 | } |
386 | 386 | ||
387 | 387 | ||
diff --git a/noncore/games/solitaire/chicanecardgame.cpp b/noncore/games/solitaire/chicanecardgame.cpp index a242419..6729a94 100644 --- a/noncore/games/solitaire/chicanecardgame.cpp +++ b/noncore/games/solitaire/chicanecardgame.cpp | |||
@@ -4,33 +4,39 @@ | |||
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 | ** Modified by C.A.Mader 2002 | 20 | ** created on base of patiencecardgame by cam (C.A.Mader) 2002 |
21 | ** Rules for this game: | ||
22 | **use 2 decks = 104 cards | ||
23 | **deal 8 rows with 3 hidden cards and one open card | ||
24 | ** append red to black and vice versa | ||
25 | **each card can be layed on a free place | ||
26 | **deal 8 cards at once | ||
21 | ** | 27 | ** |
22 | **********************************************************************/ | 28 | **********************************************************************/ |
23 | #include <qgfx_qws.h> | 29 | #include <qgfx_qws.h> |
24 | #include "chicanecardgame.h" | 30 | #include "chicanecardgame.h" |
25 | 31 | ||
26 | 32 | ||
27 | extern int highestZ; | 33 | extern int highestZ; |
28 | 34 | ||
29 | 35 | ||
30 | ChicaneCardGame::ChicaneCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent, 2)// Use 2 Decks | 36 | ChicaneCardGame::ChicaneCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent, 2)// Use 2 Decks |
31 | { | 37 | { |
32 | highestZ = 0; | 38 | highestZ = 0; |
33 | 39 | ||
34 | for (int i = 0; i < 8; i++) { | 40 | for (int i = 0; i < 8; i++) { |
35 | discardPiles[i] = new ChicaneDiscardPile( 27 + i * 26, 10, canvas() ); | 41 | discardPiles[i] = new ChicaneDiscardPile( 27 + i * 26, 10, canvas() ); |
36 | addCardPile(discardPiles[i]); | 42 | addCardPile(discardPiles[i]); |
diff --git a/noncore/games/solitaire/chicanecardgame.h b/noncore/games/solitaire/chicanecardgame.h index 668f5f4..f6bd08e 100644 --- a/noncore/games/solitaire/chicanecardgame.h +++ b/noncore/games/solitaire/chicanecardgame.h | |||
@@ -3,32 +3,41 @@ | |||
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 | ** | ||
20 | ** created on base of patiencecardgame by cam (C.A.Mader) 2002 | ||
21 | ** Rules for this game: | ||
22 | ** use 2 decks = 104 cards | ||
23 | ** deal 8 rows with 3 hidden cards and one open card | ||
24 | ** append red to black and vice versa | ||
25 | ** each card can be layed on a free place | ||
26 | ** deal 8 cards at once | ||
27 | ** | ||
19 | **********************************************************************/ | 28 | **********************************************************************/ |
20 | #ifndef CHICANE_CARD_GAME_H | 29 | #ifndef CHICANE_CARD_GAME_H |
21 | #define CHICANE_CARD_GAME_H | 30 | #define CHICANE_CARD_GAME_H |
22 | 31 | ||
23 | 32 | ||
24 | #include "patiencecardgame.h" | 33 | #include "patiencecardgame.h" |
25 | 34 | ||
26 | 35 | ||
27 | class ChicaneFaceDownDeck : public PatienceFaceDownDeck | 36 | class ChicaneFaceDownDeck : public PatienceFaceDownDeck |
28 | { | 37 | { |
29 | public: | 38 | public: |
30 | ChicaneFaceDownDeck(int x, int y, QCanvas *canvas) : | 39 | ChicaneFaceDownDeck(int x, int y, QCanvas *canvas) : |
31 | PatienceFaceDownDeck(x, y, canvas) { } | 40 | PatienceFaceDownDeck(x, y, canvas) { } |
32 | 41 | ||
33 | }; | 42 | }; |
34 | 43 | ||
@@ -37,34 +46,34 @@ class ChicaneDiscardPile : public PatienceDiscardPile | |||
37 | { | 46 | { |
38 | public: | 47 | public: |
39 | ChicaneDiscardPile(int x, int y, QCanvas *canvas) : | 48 | ChicaneDiscardPile(int x, int y, QCanvas *canvas) : |
40 | PatienceDiscardPile(x, y, canvas) { } | 49 | PatienceDiscardPile(x, y, canvas) { } |
41 | 50 | ||
42 | }; | 51 | }; |
43 | 52 | ||
44 | 53 | ||
45 | class ChicaneWorkingPile : public PatienceWorkingPile | 54 | class ChicaneWorkingPile : public PatienceWorkingPile |
46 | { | 55 | { |
47 | public: | 56 | public: |
48 | ChicaneWorkingPile(int x, int y, QCanvas *canvas) : | 57 | ChicaneWorkingPile(int x, int y, QCanvas *canvas) : |
49 | PatienceWorkingPile(x, y, canvas) { } | 58 | PatienceWorkingPile(x, y, canvas) { } |
50 | 59 | ||
51 | virtual bool isAllowedOnTop(Card *card) { | 60 | virtual bool isAllowedOnTop(Card *card) { |
52 | if ( card->isFacing() && | 61 | if ( card->isFacing() && |
53 | // ( ( ( cardOnTop() == NULL ) && (card->getValue() == king) ) || // diese Zeile sorgt dafür dass nur Kings auf leere Plätze dürfen | 62 | // ( ( ( cardOnTop() == NULL ) && (card->getValue() == king) ) || // only kings are allowed on empty places |
54 | ( (cardOnTop() == NULL) || // auf einen Freiplatz darf alles! | 63 | ( (cardOnTop() == NULL) || // each card can use an empty place |
55 | ( (cardOnTop() != NULL) && | 64 | ( (cardOnTop() != NULL) && |
56 | ((int)card->getValue() + 1 == (int)cardOnTop()->getValue()) && | 65 | ((int)card->getValue() + 1 == (int)cardOnTop()->getValue()) && |
57 | (card->isRed() != cardOnTop()->isRed()) ) ) ) | 66 | (card->isRed() != cardOnTop()->isRed()) ) ) ) |
58 | return TRUE; | 67 | return TRUE; |
59 | return FALSE; | 68 | return FALSE; |
60 | } | 69 | } |
61 | virtual bool isAllowedToBeMoved(Card *card) { | 70 | virtual bool isAllowedToBeMoved(Card *card) { |
62 | if (!card->isFacing()) return FALSE; | 71 | if (!card->isFacing()) return FALSE; |
63 | 72 | ||
64 | int nextExpectedValue = (int)card->getValue(); | 73 | int nextExpectedValue = (int)card->getValue(); |
65 | bool nextExpectedColor = card->isRed(); | 74 | bool nextExpectedColor = card->isRed(); |
66 | 75 | ||
67 | while ((card != NULL)) { | 76 | while ((card != NULL)) { |
68 | if ( (int)card->getValue() != nextExpectedValue ) | 77 | if ( (int)card->getValue() != nextExpectedValue ) |
69 | return FALSE; | 78 | return FALSE; |
70 | if ( card->isRed() != nextExpectedColor ) | 79 | if ( card->isRed() != nextExpectedColor ) |
@@ -79,49 +88,49 @@ public: | |||
79 | virtual void cardRemoved(Card *card) { | 88 | virtual void cardRemoved(Card *card) { |
80 | Q_UNUSED(card); | 89 | Q_UNUSED(card); |
81 | 90 | ||
82 | Card *newTopCard = cardOnTop(); | 91 | Card *newTopCard = cardOnTop(); |
83 | 92 | ||
84 | if ( !newTopCard ) { | 93 | if ( !newTopCard ) { |
85 | top = QPoint( pileX, pileY ); | 94 | top = QPoint( pileX, pileY ); |
86 | setNextX( pileX ); | 95 | setNextX( pileX ); |
87 | setNextY( pileY ); | 96 | setNextY( pileY ); |
88 | return; | 97 | return; |
89 | } else { | 98 | } else { |
90 | top = getCardPos(NULL); | 99 | top = getCardPos(NULL); |
91 | if ( newTopCard->isFacing() == FALSE ) { | 100 | if ( newTopCard->isFacing() == FALSE ) { |
92 | int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13; | 101 | int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13; |
93 | // correct the position taking in to account the card is not | 102 | // correct the position taking in to account the card is not |
94 | // yet flipped, but will become flipped | 103 | // yet flipped, but will become flipped |
95 | top = QPoint( top.x(), top.y() - 3 ); // Keine Verschiebung! | 104 | top = QPoint( top.x(), top.y() - 3 ); // no moving to the side |
96 | newTopCard->flipTo( top.x(), top.y() ); | 105 | newTopCard->flipTo( top.x(), top.y() ); |
97 | top = QPoint( top.x(), top.y() + offsetDown ); | 106 | top = QPoint( top.x(), top.y() + offsetDown ); |
98 | } | 107 | } |
99 | setNextX( top.x() ); | 108 | setNextX( top.x() ); |
100 | setNextY( top.y() ); | 109 | setNextY( top.y() ); |
101 | } | 110 | } |
102 | } | 111 | } |
103 | virtual QPoint getCardPos(Card *c) { | 112 | virtual QPoint getCardPos(Card *c) { |
104 | int x = pileX, y = pileY; | 113 | int x = pileX, y = pileY; |
105 | Card *card = cardOnBottom(); | 114 | Card *card = cardOnBottom(); |
106 | while ((card != c) && (card != NULL)) { | 115 | while ((card != c) && (card != NULL)) { |
107 | if (card->isFacing()) { | 116 | if (card->isFacing()) { |
108 | int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13; | 117 | int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13; |
109 | y += offsetDown; | 118 | y += offsetDown; |
110 | } else { | 119 | } else { |
111 | x += 0; // Keine Verschiebung! | 120 | x += 0; // no moving to the side |
112 | y += 3; | 121 | y += 3; |
113 | } | 122 | } |
114 | card = cardInfront(card); | 123 | card = cardInfront(card); |
115 | } | 124 | } |
116 | return QPoint( x, y ); | 125 | return QPoint( x, y ); |
117 | } | 126 | } |
118 | 127 | ||
119 | virtual QPoint getHypertheticalNextCardPos(void) { | 128 | virtual QPoint getHypertheticalNextCardPos(void) { |
120 | // return top; | 129 | // return top; |
121 | return QPoint( getNextX(), getNextY() ); | 130 | return QPoint( getNextX(), getNextY() ); |
122 | } | 131 | } |
123 | 132 | ||
124 | private: | 133 | private: |
125 | QPoint top; | 134 | QPoint top; |
126 | 135 | ||
127 | }; | 136 | }; |
diff --git a/noncore/games/solitaire/harpcardgame.cpp b/noncore/games/solitaire/harpcardgame.cpp index 22715ec..0711622 100644 --- a/noncore/games/solitaire/harpcardgame.cpp +++ b/noncore/games/solitaire/harpcardgame.cpp | |||
@@ -4,33 +4,41 @@ | |||
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 | ** Modified by C.A.Mader 2002 | 20 | ** created on base of patiencecardgame by cam (C.A.Mader) 2002 |
21 | ** Rules for this game: | ||
22 | ** use 2 decks = 104 cards | ||
23 | ** deal 8 rows with one open card in the first place | ||
24 | ** one hidden and one open in the second place and so on | ||
25 | ** append red to black and vice versa | ||
26 | ** each card can be layed on a free place | ||
27 | ** deal 8 cards at once | ||
28 | ** | ||
21 | ** | 29 | ** |
22 | **********************************************************************/ | 30 | **********************************************************************/ |
23 | #include <qgfx_qws.h> | 31 | #include <qgfx_qws.h> |
24 | #include "harpcardgame.h" | 32 | #include "harpcardgame.h" |
25 | 33 | ||
26 | 34 | ||
27 | extern int highestZ; | 35 | extern int highestZ; |
28 | 36 | ||
29 | 37 | ||
30 | HarpCardGame::HarpCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent, 2)// Use 2 Decks | 38 | HarpCardGame::HarpCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent, 2)// Use 2 Decks |
31 | { | 39 | { |
32 | highestZ = 0; | 40 | highestZ = 0; |
33 | 41 | ||
34 | for (int i = 0; i < 8; i++) { | 42 | for (int i = 0; i < 8; i++) { |
35 | discardPiles[i] = new HarpDiscardPile( 27 + i * 26, 10, canvas() ); | 43 | discardPiles[i] = new HarpDiscardPile( 27 + i * 26, 10, canvas() ); |
36 | addCardPile(discardPiles[i]); | 44 | addCardPile(discardPiles[i]); |
diff --git a/noncore/games/solitaire/harpcardgame.h b/noncore/games/solitaire/harpcardgame.h index d1733fd..18b95e3 100644 --- a/noncore/games/solitaire/harpcardgame.h +++ b/noncore/games/solitaire/harpcardgame.h | |||
@@ -3,32 +3,42 @@ | |||
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 | ** | ||
20 | ** created on base of patiencecardgame by cam (C.A.Mader) 2002 | ||
21 | ** Rules for this game: | ||
22 | ** use 2 decks = 104 cards | ||
23 | ** deal 8 rows with one open card in the first place | ||
24 | **one hidden and one open in the second place and so on | ||
25 | ** append red to black and vice versa | ||
26 | ** each card can be layed on a free place | ||
27 | ** deal 8 cards at once | ||
28 | ** | ||
19 | **********************************************************************/ | 29 | **********************************************************************/ |
20 | #ifndef HARP_CARD_GAME_H | 30 | #ifndef HARP_CARD_GAME_H |
21 | #define HARP_CARD_GAME_H | 31 | #define HARP_CARD_GAME_H |
22 | 32 | ||
23 | 33 | ||
24 | #include "patiencecardgame.h" | 34 | #include "patiencecardgame.h" |
25 | 35 | ||
26 | 36 | ||
27 | class HarpFaceDownDeck : public PatienceFaceDownDeck | 37 | class HarpFaceDownDeck : public PatienceFaceDownDeck |
28 | { | 38 | { |
29 | public: | 39 | public: |
30 | HarpFaceDownDeck(int x, int y, QCanvas *canvas) : | 40 | HarpFaceDownDeck(int x, int y, QCanvas *canvas) : |
31 | PatienceFaceDownDeck(x, y, canvas) { } | 41 | PatienceFaceDownDeck(x, y, canvas) { } |
32 | 42 | ||
33 | }; | 43 | }; |
34 | 44 | ||
@@ -37,34 +47,34 @@ class HarpDiscardPile : public PatienceDiscardPile | |||
37 | { | 47 | { |
38 | public: | 48 | public: |
39 | HarpDiscardPile(int x, int y, QCanvas *canvas) : | 49 | HarpDiscardPile(int x, int y, QCanvas *canvas) : |
40 | PatienceDiscardPile(x, y, canvas) { } | 50 | PatienceDiscardPile(x, y, canvas) { } |
41 | 51 | ||
42 | }; | 52 | }; |
43 | 53 | ||
44 | 54 | ||
45 | class HarpWorkingPile : public PatienceWorkingPile | 55 | class HarpWorkingPile : public PatienceWorkingPile |
46 | { | 56 | { |
47 | public: | 57 | public: |
48 | HarpWorkingPile(int x, int y, QCanvas *canvas) : | 58 | HarpWorkingPile(int x, int y, QCanvas *canvas) : |
49 | PatienceWorkingPile(x, y, canvas) { } | 59 | PatienceWorkingPile(x, y, canvas) { } |
50 | 60 | ||
51 | virtual bool isAllowedOnTop(Card *card) { | 61 | virtual bool isAllowedOnTop(Card *card) { |
52 | if ( card->isFacing() && | 62 | if ( card->isFacing() && |
53 | // ( ( ( cardOnTop() == NULL ) && (card->getValue() == king) ) || // diese Zeile sorgt dafür dass nur Kings auf leere Plätze dürfen | 63 | // ( ( ( cardOnTop() == NULL ) && (card->getValue() == king) ) || // only kings are allowed on empty places |
54 | ( (cardOnTop() == NULL) || // auf einen Freiplatz darf alles! | 64 | ( (cardOnTop() == NULL) || // aeach card can use an emply place |
55 | ( (cardOnTop() != NULL) && | 65 | ( (cardOnTop() != NULL) && |
56 | ((int)card->getValue() + 1 == (int)cardOnTop()->getValue()) && | 66 | ((int)card->getValue() + 1 == (int)cardOnTop()->getValue()) && |
57 | (card->isRed() != cardOnTop()->isRed()) ) ) ) | 67 | (card->isRed() != cardOnTop()->isRed()) ) ) ) |
58 | return TRUE; | 68 | return TRUE; |
59 | return FALSE; | 69 | return FALSE; |
60 | } | 70 | } |
61 | virtual bool isAllowedToBeMoved(Card *card) { | 71 | virtual bool isAllowedToBeMoved(Card *card) { |
62 | if (!card->isFacing()) return FALSE; | 72 | if (!card->isFacing()) return FALSE; |
63 | 73 | ||
64 | int nextExpectedValue = (int)card->getValue(); | 74 | int nextExpectedValue = (int)card->getValue(); |
65 | bool nextExpectedColor = card->isRed(); | 75 | bool nextExpectedColor = card->isRed(); |
66 | 76 | ||
67 | while ((card != NULL)) { | 77 | while ((card != NULL)) { |
68 | if ( (int)card->getValue() != nextExpectedValue ) | 78 | if ( (int)card->getValue() != nextExpectedValue ) |
69 | return FALSE; | 79 | return FALSE; |
70 | if ( card->isRed() != nextExpectedColor ) | 80 | if ( card->isRed() != nextExpectedColor ) |
@@ -79,49 +89,49 @@ public: | |||
79 | virtual void cardRemoved(Card *card) { | 89 | virtual void cardRemoved(Card *card) { |
80 | Q_UNUSED(card); | 90 | Q_UNUSED(card); |
81 | 91 | ||
82 | Card *newTopCard = cardOnTop(); | 92 | Card *newTopCard = cardOnTop(); |
83 | 93 | ||
84 | if ( !newTopCard ) { | 94 | if ( !newTopCard ) { |
85 | top = QPoint( pileX, pileY ); | 95 | top = QPoint( pileX, pileY ); |
86 | setNextX( pileX ); | 96 | setNextX( pileX ); |
87 | setNextY( pileY ); | 97 | setNextY( pileY ); |
88 | return; | 98 | return; |
89 | } else { | 99 | } else { |
90 | top = getCardPos(NULL); | 100 | top = getCardPos(NULL); |
91 | if ( newTopCard->isFacing() == FALSE ) { | 101 | if ( newTopCard->isFacing() == FALSE ) { |
92 | int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13; | 102 | int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13; |
93 | // correct the position taking in to account the card is not | 103 | // correct the position taking in to account the card is not |
94 | // yet flipped, but will become flipped | 104 | // yet flipped, but will become flipped |
95 | top = QPoint( top.x(), top.y() - 3 ); // Keine Verschiebung! | 105 | top = QPoint( top.x(), top.y() - 3 ); // no moving to the side |
96 | newTopCard->flipTo( top.x(), top.y() ); | 106 | newTopCard->flipTo( top.x(), top.y() ); |
97 | top = QPoint( top.x(), top.y() + offsetDown ); | 107 | top = QPoint( top.x(), top.y() + offsetDown ); |
98 | } | 108 | } |
99 | setNextX( top.x() ); | 109 | setNextX( top.x() ); |
100 | setNextY( top.y() ); | 110 | setNextY( top.y() ); |
101 | } | 111 | } |
102 | } | 112 | } |
103 | virtual QPoint getCardPos(Card *c) { | 113 | virtual QPoint getCardPos(Card *c) { |
104 | int x = pileX, y = pileY; | 114 | int x = pileX, y = pileY; |
105 | Card *card = cardOnBottom(); | 115 | Card *card = cardOnBottom(); |
106 | while ((card != c) && (card != NULL)) { | 116 | while ((card != c) && (card != NULL)) { |
107 | if (card->isFacing()) { | 117 | if (card->isFacing()) { |
108 | int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13; | 118 | int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13; |
109 | y += offsetDown; | 119 | y += offsetDown; |
110 | } else { | 120 | } else { |
111 | x += 0; // Keine Verschiebung! | 121 | x += 0; // no moving to the side |
112 | y += 3; | 122 | y += 3; |
113 | } | 123 | } |
114 | card = cardInfront(card); | 124 | card = cardInfront(card); |
115 | } | 125 | } |
116 | return QPoint( x, y ); | 126 | return QPoint( x, y ); |
117 | } | 127 | } |
118 | 128 | ||
119 | virtual QPoint getHypertheticalNextCardPos(void) { | 129 | virtual QPoint getHypertheticalNextCardPos(void) { |
120 | // return top; | 130 | // return top; |
121 | return QPoint( getNextX(), getNextY() ); | 131 | return QPoint( getNextX(), getNextY() ); |
122 | } | 132 | } |
123 | 133 | ||
124 | private: | 134 | private: |
125 | QPoint top; | 135 | QPoint top; |
126 | 136 | ||
127 | }; | 137 | }; |
diff --git a/noncore/games/solitaire/teeclubcardgame.cpp b/noncore/games/solitaire/teeclubcardgame.cpp index e15da96..0941e0d 100644 --- a/noncore/games/solitaire/teeclubcardgame.cpp +++ b/noncore/games/solitaire/teeclubcardgame.cpp | |||
@@ -4,33 +4,41 @@ | |||
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 | ** Modified by C.A.Mader 2002 | 20 | ** created on base of patiencecardgame by cam (C.A.Mader) 2002 |
21 | ** Rules for this game: | ||
22 | ** use 2 decks = 104 cards | ||
23 | ** deal 9 rows with 5 open cards each | ||
24 | ** append one card to each other card which is one step higher | ||
25 | ** move only columns of cards which are equal in suit | ||
26 | ** each card can be layed on a free place | ||
27 | ** deal 1 card at once on the first pile | ||
28 | ** | ||
21 | ** | 29 | ** |
22 | **********************************************************************/ | 30 | **********************************************************************/ |
23 | #include <qgfx_qws.h> | 31 | #include <qgfx_qws.h> |
24 | #include "teeclubcardgame.h" | 32 | #include "teeclubcardgame.h" |
25 | 33 | ||
26 | 34 | ||
27 | extern int highestZ; | 35 | extern int highestZ; |
28 | 36 | ||
29 | 37 | ||
30 | TeeclubCardGame::TeeclubCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent, 2)// Use 2 Decks | 38 | TeeclubCardGame::TeeclubCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent, 2)// Use 2 Decks |
31 | { | 39 | { |
32 | highestZ = 0; | 40 | highestZ = 0; |
33 | 41 | ||
34 | for (int i = 0; i < 8; i++) { | 42 | for (int i = 0; i < 8; i++) { |
35 | discardPiles[i] = new TeeclubDiscardPile( 27 + i * 26, 10, canvas() ); | 43 | discardPiles[i] = new TeeclubDiscardPile( 27 + i * 26, 10, canvas() ); |
36 | addCardPile(discardPiles[i]); | 44 | addCardPile(discardPiles[i]); |
@@ -71,33 +79,33 @@ void TeeclubCardGame::deal(void) | |||
71 | card->setCardPile( faceDownDealingPile ); | 79 | card->setCardPile( faceDownDealingPile ); |
72 | QPoint p = faceDownDealingPile->getCardPos( card ); | 80 | QPoint p = faceDownDealingPile->getCardPos( card ); |
73 | card->setPos( p.x(), p.y(), highestZ ); | 81 | card->setPos( p.x(), p.y(), highestZ ); |
74 | card->showCard(); | 82 | card->showCard(); |
75 | highestZ++; | 83 | highestZ++; |
76 | } | 84 | } |
77 | 85 | ||
78 | endDealing(); | 86 | endDealing(); |
79 | } | 87 | } |
80 | 88 | ||
81 | 89 | ||
82 | void TeeclubCardGame::resizePiles() | 90 | void TeeclubCardGame::resizePiles() |
83 | { | 91 | { |
84 | beginDealing(); | 92 | beginDealing(); |
85 | for (int i = 0; i < 9; i++) { | 93 | for (int i = 0; i < 9; i++) { |
86 | while ((workingPiles[i]->getCardPos(NULL).y() > 230) && (workingPiles[i]->getOffsetDown()>1)) { | 94 | while ((workingPiles[i]->getCardPos(NULL).y() > 230) && (workingPiles[i]->getOffsetDown()>1)) { |
87 | // Resizen des Stapels | 95 | // resize the pile |
88 | workingPiles[i]->setOffsetDown(workingPiles[i]->getOffsetDown()-1); | 96 | workingPiles[i]->setOffsetDown(workingPiles[i]->getOffsetDown()-1); |
89 | Card *card = workingPiles[i]->cardOnBottom(); | 97 | Card *card = workingPiles[i]->cardOnBottom(); |
90 | int p=0; | 98 | int p=0; |
91 | while (card != NULL) { | 99 | while (card != NULL) { |
92 | card->setPos( 0, 0, p++ ); | 100 | card->setPos( 0, 0, p++ ); |
93 | card->move( workingPiles[i]->getCardPos( card ) ); | 101 | card->move( workingPiles[i]->getCardPos( card ) ); |
94 | card = workingPiles[i]->cardInfront(card); | 102 | card = workingPiles[i]->cardInfront(card); |
95 | } | 103 | } |
96 | } | 104 | } |
97 | } | 105 | } |
98 | endDealing(); | 106 | endDealing(); |
99 | } | 107 | } |
100 | 108 | ||
101 | 109 | ||
102 | void TeeclubCardGame::readConfig( Config& cfg ) | 110 | void TeeclubCardGame::readConfig( Config& cfg ) |
103 | { | 111 | { |
diff --git a/noncore/games/solitaire/teeclubcardgame.h b/noncore/games/solitaire/teeclubcardgame.h index 06d49f8..25cfaf9 100644 --- a/noncore/games/solitaire/teeclubcardgame.h +++ b/noncore/games/solitaire/teeclubcardgame.h | |||
@@ -3,32 +3,43 @@ | |||
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 | ** | ||
20 | ** created on base of patiencecardgame by cam (C.A.Mader) 2002 | ||
21 | ** Rules for this game: | ||
22 | ** use 2 decks = 104 cards | ||
23 | ** deal 9 rows with 5 open cards each | ||
24 | ** append one card to each other card which is one step higher | ||
25 | **move only columns of cards which are equal in suit | ||
26 | ** each card can be layed on a free place | ||
27 | ** deal 1 card at once on the first pile | ||
28 | ** | ||
29 | ** | ||
19 | **********************************************************************/ | 30 | **********************************************************************/ |
20 | #ifndef TEECLUB_CARD_GAME_H | 31 | #ifndef TEECLUB_CARD_GAME_H |
21 | #define TEECLUB_CARD_GAME_H | 32 | #define TEECLUB_CARD_GAME_H |
22 | 33 | ||
23 | 34 | ||
24 | #include "patiencecardgame.h" | 35 | #include "patiencecardgame.h" |
25 | 36 | ||
26 | 37 | ||
27 | class TeeclubFaceDownDeck : public PatienceFaceDownDeck | 38 | class TeeclubFaceDownDeck : public PatienceFaceDownDeck |
28 | { | 39 | { |
29 | public: | 40 | public: |
30 | TeeclubFaceDownDeck(int x, int y, QCanvas *canvas) : | 41 | TeeclubFaceDownDeck(int x, int y, QCanvas *canvas) : |
31 | PatienceFaceDownDeck(x, y, canvas) { } | 42 | PatienceFaceDownDeck(x, y, canvas) { } |
32 | 43 | ||
33 | }; | 44 | }; |
34 | 45 | ||
@@ -36,49 +47,49 @@ public: | |||
36 | class TeeclubDiscardPile : public CardPile, public CanvasRoundRect | 47 | class TeeclubDiscardPile : public CardPile, public CanvasRoundRect |
37 | { | 48 | { |
38 | public: | 49 | public: |
39 | TeeclubDiscardPile(int x, int y, QCanvas *canvas) | 50 | TeeclubDiscardPile(int x, int y, QCanvas *canvas) |
40 | : CardPile(x, y), CanvasRoundRect(x, y, canvas) { } | 51 | : CardPile(x, y), CanvasRoundRect(x, y, canvas) { } |
41 | virtual bool isAllowedOnTop(Card *card) { | 52 | virtual bool isAllowedOnTop(Card *card) { |
42 | if ( card->isFacing() && ( card->getCardPile()->cardInfront(card) == NULL ) && | 53 | if ( card->isFacing() && ( card->getCardPile()->cardInfront(card) == NULL ) && |
43 | ( ( ( cardOnTop() == NULL ) && ( card->getValue() == ace ) ) || | 54 | ( ( ( cardOnTop() == NULL ) && ( card->getValue() == ace ) ) || |
44 | ( ( cardOnTop() != NULL ) && | 55 | ( ( cardOnTop() != NULL ) && |
45 | ( (int)card->getValue() == (int)cardOnTop()->getValue() + 1 ) && | 56 | ( (int)card->getValue() == (int)cardOnTop()->getValue() + 1 ) && |
46 | ( card->getSuit() == cardOnTop()->getSuit() ) ) ) ) | 57 | ( card->getSuit() == cardOnTop()->getSuit() ) ) ) ) |
47 | return TRUE; | 58 | return TRUE; |
48 | return FALSE; | 59 | return FALSE; |
49 | } | 60 | } |
50 | virtual bool isAllowedToBeMoved(Card *card) { | 61 | virtual bool isAllowedToBeMoved(Card *card) { |
51 | if (card->isFacing()) return FALSE; | 62 | if (card->isFacing()) return FALSE; |
52 | return FALSE; // die Toten ruhn | 63 | return FALSE; // the deads are sleeping forever |
53 | } | 64 | } |
54 | }; | 65 | }; |
55 | 66 | ||
56 | 67 | ||
57 | class TeeclubWorkingPile : public PatienceWorkingPile | 68 | class TeeclubWorkingPile : public PatienceWorkingPile |
58 | { | 69 | { |
59 | public: | 70 | public: |
60 | TeeclubWorkingPile(int x, int y, QCanvas *canvas) : | 71 | TeeclubWorkingPile(int x, int y, QCanvas *canvas) : |
61 | PatienceWorkingPile(x, y, canvas) { } | 72 | PatienceWorkingPile(x, y, canvas) { } |
62 | 73 | ||
63 | virtual bool isAllowedOnTop(Card *card) { | 74 | virtual bool isAllowedOnTop(Card *card) { |
64 | if ( card->isFacing() && | 75 | if ( card->isFacing() && |
65 | // ( ( ( cardOnTop() == NULL ) && (card->getValue() == king) ) || // diese Zeile sorgt dafür dass nur Kings auf leere Plätze dürfen | 76 | // ( ( ( cardOnTop() == NULL ) && (card->getValue() == king) ) || // use this if only Kings are allowed on empty places |
66 | ( (cardOnTop() == NULL) || // auf einen Freiplatz darf alles! | 77 | ( (cardOnTop() == NULL) || // each card can use an empty place |
67 | ( (cardOnTop() != NULL) && | 78 | ( (cardOnTop() != NULL) && |
68 | ((int)card->getValue() + 1 == (int)cardOnTop()->getValue()) // bei teeclub sind die farben zum Anlegen egal | 79 | ((int)card->getValue() + 1 == (int)cardOnTop()->getValue()) // you can append every color on every color |
69 | ) ) ) | 80 | ) ) ) |
70 | return TRUE; | 81 | return TRUE; |
71 | return FALSE; | 82 | return FALSE; |
72 | } | 83 | } |
73 | 84 | ||
74 | virtual bool isAllowedToBeMoved(Card *card) { | 85 | virtual bool isAllowedToBeMoved(Card *card) { |
75 | if (!card->isFacing()) return FALSE; | 86 | if (!card->isFacing()) return FALSE; |
76 | 87 | ||
77 | int nextExpectedValue = (int)card->getValue(); | 88 | int nextExpectedValue = (int)card->getValue(); |
78 | eSuit nextExpectedSuit = card->getSuit(); | 89 | eSuit nextExpectedSuit = card->getSuit(); |
79 | 90 | ||
80 | while ((card != NULL)) { | 91 | while ((card != NULL)) { |
81 | if ( (int)card->getValue() != nextExpectedValue ) | 92 | if ( (int)card->getValue() != nextExpectedValue ) |
82 | return FALSE; | 93 | return FALSE; |
83 | if ( card->getSuit() != nextExpectedSuit ) | 94 | if ( card->getSuit() != nextExpectedSuit ) |
84 | return FALSE; | 95 | return FALSE; |
@@ -92,82 +103,82 @@ public: | |||
92 | Q_UNUSED(card); | 103 | Q_UNUSED(card); |
93 | 104 | ||
94 | Card *newTopCard = cardOnTop(); | 105 | Card *newTopCard = cardOnTop(); |
95 | 106 | ||
96 | if ( !newTopCard ) { | 107 | if ( !newTopCard ) { |
97 | top = QPoint( pileX, pileY ); | 108 | top = QPoint( pileX, pileY ); |
98 | setNextX( pileX ); | 109 | setNextX( pileX ); |
99 | setNextY( pileY ); | 110 | setNextY( pileY ); |
100 | setOffsetDown(13); | 111 | setOffsetDown(13); |
101 | return; | 112 | return; |
102 | } else { | 113 | } else { |
103 | top = getCardPos(NULL); | 114 | top = getCardPos(NULL); |
104 | if ( newTopCard->isFacing() == FALSE ) { | 115 | if ( newTopCard->isFacing() == FALSE ) { |
105 | int offsetDown = newTopCard->getCardPile()->getOffsetDown(); | 116 | int offsetDown = newTopCard->getCardPile()->getOffsetDown(); |
106 | // correct the position taking in to account the card is not | 117 | // correct the position taking in to account the card is not |
107 | // yet flipped, but will become flipped | 118 | // yet flipped, but will become flipped |
108 | top = QPoint( top.x(), top.y() - 3 ); // Keine seitliche Verschiebung! | 119 | top = QPoint( top.x(), top.y() - 3 ); // no moving to the side |
109 | newTopCard->flipTo( top.x(), top.y() ); | 120 | newTopCard->flipTo( top.x(), top.y() ); |
110 | top = QPoint( top.x(), top.y() + offsetDown ); | 121 | top = QPoint( top.x(), top.y() + offsetDown ); |
111 | } | 122 | } |
112 | setNextX( top.x() ); | 123 | setNextX( top.x() ); |
113 | setNextY( top.y() ); | 124 | setNextY( top.y() ); |
114 | } | 125 | } |
115 | 126 | ||
116 | if ((getCardPos(NULL).y() < 230) && (getOffsetDown()<13)) { | 127 | if ((getCardPos(NULL).y() < 230) && (getOffsetDown()<13)) { |
117 | // Resizen des Stapels | 128 | // resize the pile |
118 | beginDealing(); | 129 | beginDealing(); |
119 | setOffsetDown(getOffsetDown()+1); | 130 | setOffsetDown(getOffsetDown()+1); |
120 | Card *card = cardOnBottom(); | 131 | Card *card = cardOnBottom(); |
121 | int p=0; | 132 | int p=0; |
122 | while (card != NULL) { | 133 | while (card != NULL) { |
123 | card->setPos( 0, 0, p++ ); | 134 | card->setPos( 0, 0, p++ ); |
124 | card->move( getCardPos( card ) ); | 135 | card->move( getCardPos( card ) ); |
125 | card = cardInfront(card); | 136 | card = cardInfront(card); |
126 | } | 137 | } |
127 | endDealing(); | 138 | endDealing(); |
128 | } | 139 | } |
129 | } | 140 | } |
130 | 141 | ||
131 | virtual QPoint getCardPos(Card *c) { | 142 | virtual QPoint getCardPos(Card *c) { |
132 | int x = pileX, y = pileY; | 143 | int x = pileX, y = pileY; |
133 | Card *card = cardOnBottom(); | 144 | Card *card = cardOnBottom(); |
134 | while ((card != c) && (card != NULL)) { | 145 | while ((card != c) && (card != NULL)) { |
135 | if (card->isFacing()) { | 146 | if (card->isFacing()) { |
136 | int offsetDown = card->getCardPile()->getOffsetDown(); | 147 | int offsetDown = card->getCardPile()->getOffsetDown(); |
137 | y += offsetDown; | 148 | y += offsetDown; |
138 | } else { | 149 | } else { |
139 | x += 0; // Keine seitliche Verschiebung! | 150 | x += 0; // no moving to the side |
140 | y += 3; | 151 | y += 3; |
141 | } | 152 | } |
142 | card = cardInfront(card); | 153 | card = cardInfront(card); |
143 | } | 154 | } |
144 | return QPoint( x, y ); | 155 | return QPoint( x, y ); |
145 | } | 156 | } |
146 | 157 | ||
147 | virtual QPoint getHypertheticalNextCardPos(void) { | 158 | virtual QPoint getHypertheticalNextCardPos(void) { |
148 | return QPoint( getNextX(), getNextY() ); | 159 | return QPoint( getNextX(), getNextY() ); |
149 | } | 160 | } |
150 | 161 | ||
151 | virtual void cardAddedToTop(Card *c) { | 162 | virtual void cardAddedToTop(Card *c) { |
152 | Q_UNUSED(c); | 163 | Q_UNUSED(c); |
153 | setNextX( getCardPos(NULL).x() ); | 164 | setNextX( getCardPos(NULL).x() ); |
154 | setNextY( getCardPos(NULL).y() ); | 165 | setNextY( getCardPos(NULL).y() ); |
155 | 166 | ||
156 | while (isPileResize() && (getCardPos(NULL).y() > 230) && (getOffsetDown()>1)) { | 167 | while (isPileResize() && (getCardPos(NULL).y() > 230) && (getOffsetDown()>1)) { |
157 | // Resizen des Stapels | 168 | // resize the pile |
158 | beginDealing(); | 169 | beginDealing(); |
159 | setOffsetDown(getOffsetDown()-1); | 170 | setOffsetDown(getOffsetDown()-1); |
160 | Card *card = cardOnBottom(); | 171 | Card *card = cardOnBottom(); |
161 | int p=0; | 172 | int p=0; |
162 | while (card != NULL) { | 173 | while (card != NULL) { |
163 | card->setPos( 0, 0, p++ ); | 174 | card->setPos( 0, 0, p++ ); |
164 | card->move( getCardPos( card ) ); | 175 | card->move( getCardPos( card ) ); |
165 | card = cardInfront(card); | 176 | card = cardInfront(card); |
166 | } | 177 | } |
167 | endDealing(); | 178 | endDealing(); |
168 | } | 179 | } |
169 | 180 | ||
170 | } | 181 | } |
171 | 182 | ||
172 | 183 | ||
173 | 184 | ||