-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 @@ -372,14 +372,14 @@ void CanvasCardGame::readPile( Config& cfg, CardPile *pile, QString name, int& h cardStr.sprintf( "%i", i ); int val = cfg.readNumEntry( "Card" + cardStr ); bool facing = cfg.readBoolEntry( "CardFacing" + cardStr ); card = cards[ val ]; card->setFace(facing); - card->setCardPile(pile); // cam: setCardPile muss vor addCardToTop passieren - pile->addCardToTop(card); // weil sonst absturz wg cardAddedToTop + card->setCardPile(pile); // cam: setCardPile has to happen bevor addCardToTop + pile->addCardToTop(card); // due to a empty pointer if you use cardAddedToTop QPoint p = pile->getCardPos( card ); card->setPos( p.x(), p.y(), highestZ ); card->showCard(); highestZ++; } } 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 @@ -14,13 +14,19 @@ ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** ** -** Modified by C.A.Mader 2002 +** created on base of patiencecardgame by cam (C.A.Mader) 2002 +** Rules for this game: +** use 2 decks = 104 cards +** deal 8 rows with 3 hidden cards and one open card +** append red to black and vice versa +** each card can be layed on a free place +** deal 8 cards at once ** **********************************************************************/ #include <qgfx_qws.h> #include "chicanecardgame.h" 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 @@ -13,12 +13,21 @@ ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** +** +** created on base of patiencecardgame by cam (C.A.Mader) 2002 +** Rules for this game: +** use 2 decks = 104 cards +** deal 8 rows with 3 hidden cards and one open card +** append red to black and vice versa +** each card can be layed on a free place +** deal 8 cards at once +** **********************************************************************/ #ifndef CHICANE_CARD_GAME_H #define CHICANE_CARD_GAME_H #include "patiencecardgame.h" @@ -47,14 +56,14 @@ class ChicaneWorkingPile : public PatienceWorkingPile public: ChicaneWorkingPile(int x, int y, QCanvas *canvas) : PatienceWorkingPile(x, y, canvas) { } virtual bool isAllowedOnTop(Card *card) { if ( card->isFacing() && -// ( ( ( cardOnTop() == NULL ) && (card->getValue() == king) ) || // diese Zeile sorgt dafür dass nur Kings auf leere Plätze dürfen - ( (cardOnTop() == NULL) || // auf einen Freiplatz darf alles! +// ( ( ( cardOnTop() == NULL ) && (card->getValue() == king) ) || // only kings are allowed on empty places + ( (cardOnTop() == NULL) || // each card can use an empty place ( (cardOnTop() != NULL) && ((int)card->getValue() + 1 == (int)cardOnTop()->getValue()) && (card->isRed() != cardOnTop()->isRed()) ) ) ) return TRUE; return FALSE; } @@ -89,13 +98,13 @@ public: } else { top = getCardPos(NULL); if ( newTopCard->isFacing() == FALSE ) { int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13; // correct the position taking in to account the card is not // yet flipped, but will become flipped - top = QPoint( top.x(), top.y() - 3 ); // Keine Verschiebung! + top = QPoint( top.x(), top.y() - 3 ); // no moving to the side newTopCard->flipTo( top.x(), top.y() ); top = QPoint( top.x(), top.y() + offsetDown ); } setNextX( top.x() ); setNextY( top.y() ); } @@ -105,13 +114,13 @@ public: Card *card = cardOnBottom(); while ((card != c) && (card != NULL)) { if (card->isFacing()) { int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13; y += offsetDown; } else { - x += 0; // Keine Verschiebung! + x += 0; // no moving to the side y += 3; } card = cardInfront(card); } return QPoint( x, y ); } 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 @@ -14,13 +14,21 @@ ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** ** -** Modified by C.A.Mader 2002 +** created on base of patiencecardgame by cam (C.A.Mader) 2002 +** Rules for this game: +** use 2 decks = 104 cards +** deal 8 rows with one open card in the first place +** one hidden and one open in the second place and so on +** append red to black and vice versa +** each card can be layed on a free place +** deal 8 cards at once +** ** **********************************************************************/ #include <qgfx_qws.h> #include "harpcardgame.h" 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 @@ -13,12 +13,22 @@ ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** +** +** created on base of patiencecardgame by cam (C.A.Mader) 2002 +** Rules for this game: +** use 2 decks = 104 cards +** deal 8 rows with one open card in the first place +** one hidden and one open in the second place and so on +** append red to black and vice versa +** each card can be layed on a free place +** deal 8 cards at once +** **********************************************************************/ #ifndef HARP_CARD_GAME_H #define HARP_CARD_GAME_H #include "patiencecardgame.h" @@ -47,14 +57,14 @@ class HarpWorkingPile : public PatienceWorkingPile public: HarpWorkingPile(int x, int y, QCanvas *canvas) : PatienceWorkingPile(x, y, canvas) { } virtual bool isAllowedOnTop(Card *card) { if ( card->isFacing() && -// ( ( ( cardOnTop() == NULL ) && (card->getValue() == king) ) || // diese Zeile sorgt dafür dass nur Kings auf leere Plätze dürfen - ( (cardOnTop() == NULL) || // auf einen Freiplatz darf alles! +// ( ( ( cardOnTop() == NULL ) && (card->getValue() == king) ) || // only kings are allowed on empty places + ( (cardOnTop() == NULL) || // aeach card can use an emply place ( (cardOnTop() != NULL) && ((int)card->getValue() + 1 == (int)cardOnTop()->getValue()) && (card->isRed() != cardOnTop()->isRed()) ) ) ) return TRUE; return FALSE; } @@ -89,13 +99,13 @@ public: } else { top = getCardPos(NULL); if ( newTopCard->isFacing() == FALSE ) { int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13; // correct the position taking in to account the card is not // yet flipped, but will become flipped - top = QPoint( top.x(), top.y() - 3 ); // Keine Verschiebung! + top = QPoint( top.x(), top.y() - 3 ); // no moving to the side newTopCard->flipTo( top.x(), top.y() ); top = QPoint( top.x(), top.y() + offsetDown ); } setNextX( top.x() ); setNextY( top.y() ); } @@ -105,13 +115,13 @@ public: Card *card = cardOnBottom(); while ((card != c) && (card != NULL)) { if (card->isFacing()) { int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13; y += offsetDown; } else { - x += 0; // Keine Verschiebung! + x += 0; // no moving to the side y += 3; } card = cardInfront(card); } return QPoint( x, y ); } 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 @@ -14,13 +14,21 @@ ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** ** -** Modified by C.A.Mader 2002 +** created on base of patiencecardgame by cam (C.A.Mader) 2002 +** Rules for this game: +** use 2 decks = 104 cards +** deal 9 rows with 5 open cards each +** append one card to each other card which is one step higher +** move only columns of cards which are equal in suit +** each card can be layed on a free place +** deal 1 card at once on the first pile +** ** **********************************************************************/ #include <qgfx_qws.h> #include "teeclubcardgame.h" @@ -81,13 +89,13 @@ void TeeclubCardGame::deal(void) void TeeclubCardGame::resizePiles() { beginDealing(); for (int i = 0; i < 9; i++) { while ((workingPiles[i]->getCardPos(NULL).y() > 230) && (workingPiles[i]->getOffsetDown()>1)) { - // Resizen des Stapels + // resize the pile workingPiles[i]->setOffsetDown(workingPiles[i]->getOffsetDown()-1); Card *card = workingPiles[i]->cardOnBottom(); int p=0; while (card != NULL) { card->setPos( 0, 0, p++ ); card->move( workingPiles[i]->getCardPos( card ) ); 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 @@ -13,12 +13,23 @@ ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** +** +** created on base of patiencecardgame by cam (C.A.Mader) 2002 +** Rules for this game: +** use 2 decks = 104 cards +** deal 9 rows with 5 open cards each +** append one card to each other card which is one step higher +** move only columns of cards which are equal in suit +** each card can be layed on a free place +** deal 1 card at once on the first pile +** +** **********************************************************************/ #ifndef TEECLUB_CARD_GAME_H #define TEECLUB_CARD_GAME_H #include "patiencecardgame.h" @@ -46,29 +57,29 @@ public: ( card->getSuit() == cardOnTop()->getSuit() ) ) ) ) return TRUE; return FALSE; } virtual bool isAllowedToBeMoved(Card *card) { if (card->isFacing()) return FALSE; - return FALSE; // die Toten ruhn + return FALSE; // the deads are sleeping forever } }; class TeeclubWorkingPile : public PatienceWorkingPile { public: TeeclubWorkingPile(int x, int y, QCanvas *canvas) : PatienceWorkingPile(x, y, canvas) { } virtual bool isAllowedOnTop(Card *card) { if ( card->isFacing() && -// ( ( ( cardOnTop() == NULL ) && (card->getValue() == king) ) || // diese Zeile sorgt dafür dass nur Kings auf leere Plätze dürfen - ( (cardOnTop() == NULL) || // auf einen Freiplatz darf alles! +// ( ( ( cardOnTop() == NULL ) && (card->getValue() == king) ) || // use this if only Kings are allowed on empty places + ( (cardOnTop() == NULL) || // each card can use an empty place ( (cardOnTop() != NULL) && - ((int)card->getValue() + 1 == (int)cardOnTop()->getValue()) // bei teeclub sind die farben zum Anlegen egal + ((int)card->getValue() + 1 == (int)cardOnTop()->getValue()) // you can append every color on every color ) ) ) return TRUE; return FALSE; } virtual bool isAllowedToBeMoved(Card *card) { @@ -102,22 +113,22 @@ public: } else { top = getCardPos(NULL); if ( newTopCard->isFacing() == FALSE ) { int offsetDown = newTopCard->getCardPile()->getOffsetDown(); // correct the position taking in to account the card is not // yet flipped, but will become flipped - top = QPoint( top.x(), top.y() - 3 ); // Keine seitliche Verschiebung! + top = QPoint( top.x(), top.y() - 3 ); // no moving to the side newTopCard->flipTo( top.x(), top.y() ); top = QPoint( top.x(), top.y() + offsetDown ); } setNextX( top.x() ); setNextY( top.y() ); } if ((getCardPos(NULL).y() < 230) && (getOffsetDown()<13)) { - // Resizen des Stapels + // resize the pile beginDealing(); setOffsetDown(getOffsetDown()+1); Card *card = cardOnBottom(); int p=0; while (card != NULL) { card->setPos( 0, 0, p++ ); @@ -133,13 +144,13 @@ public: Card *card = cardOnBottom(); while ((card != c) && (card != NULL)) { if (card->isFacing()) { int offsetDown = card->getCardPile()->getOffsetDown(); y += offsetDown; } else { - x += 0; // Keine seitliche Verschiebung! + x += 0; // no moving to the side y += 3; } card = cardInfront(card); } return QPoint( x, y ); } @@ -151,13 +162,13 @@ public: virtual void cardAddedToTop(Card *c) { Q_UNUSED(c); setNextX( getCardPos(NULL).x() ); setNextY( getCardPos(NULL).y() ); while (isPileResize() && (getCardPos(NULL).y() > 230) && (getOffsetDown()>1)) { - // Resizen des Stapels + // resize the pile beginDealing(); setOffsetDown(getOffsetDown()-1); Card *card = cardOnBottom(); int p=0; while (card != NULL) { card->setPos( 0, 0, p++ ); |