author | tille <tille> | 2002-06-28 14:56:10 (UTC) |
---|---|---|
committer | tille <tille> | 2002-06-28 14:56:10 (UTC) |
commit | ab413257c3a23f535e99f8f61468382c73bc4adb (patch) (side-by-side diff) | |
tree | 63834da1738157e52b67550d4e71058c6710f1ff /noncore/games/solitaire/carddeck.cpp | |
parent | d4626cc76127b7022c8555ea11afbb289714c851 (diff) | |
download | opie-ab413257c3a23f535e99f8f61468382c73bc4adb.zip opie-ab413257c3a23f535e99f8f61468382c73bc4adb.tar.gz opie-ab413257c3a23f535e99f8f61468382c73bc4adb.tar.bz2 |
cmader <chris@mediakreativwerk.de> impl. 2 new games
Diffstat (limited to 'noncore/games/solitaire/carddeck.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/solitaire/carddeck.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/noncore/games/solitaire/carddeck.cpp b/noncore/games/solitaire/carddeck.cpp index 87c043a..a2d0076 100644 --- a/noncore/games/solitaire/carddeck.cpp +++ b/noncore/games/solitaire/carddeck.cpp @@ -25,3 +25,3 @@ -CardDeck::CardDeck(int jokers) : numberOfJokers(jokers), deckCreated(FALSE) +CardDeck::CardDeck(int jokers, int numOfDecks) : numberOfJokers(jokers), numberOfDecks(numOfDecks), deckCreated(FALSE) { @@ -42,6 +42,10 @@ void CardDeck::createDeck() if (!deckCreated) { - for (int i = 0; i < 52; i++) - cards[i] = newCard( (eValue)((i % 13) + 1), (eSuit)((i / 13) + 1), FALSE ); + for (int j = 0; j < getNumberOfDecks(); j++) { + for (int i = 0; i < 52; i++) { + cards[i+j*52] = newCard( (eValue)((i % 13) + 1), (eSuit)((i / 13) + 1), FALSE); + cards[i+j*52]->setDeckNumber(j); + } + } for (int i = 0; i < getNumberOfJokers(); i++) - cards[52 + i] = newCard( jokerVal, jokerSuit, FALSE ); + cards[52*getNumberOfDecks() + i] = newCard( jokerVal, jokerSuit, FALSE); deckCreated = TRUE; @@ -65,3 +69,3 @@ int CardDeck::getNumberOfCards() { - return 52 + getNumberOfJokers(); + return 52*getNumberOfDecks() + getNumberOfJokers(); } @@ -69,2 +73,8 @@ int CardDeck::getNumberOfCards() +int CardDeck::getNumberOfDecks() +{ + return numberOfDecks; +} + + int CardDeck::getNumberOfJokers() @@ -75,3 +85,3 @@ int CardDeck::getNumberOfJokers() -Card *CardDeck::newCard( eValue v, eSuit s, bool f ) +Card *CardDeck::newCard( eValue v, eSuit s, bool f) { |