summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-04-26 10:24:35 (UTC)
committer llornkcor <llornkcor>2004-04-26 10:24:35 (UTC)
commitf6a98984fcb0dfc7e176636560b7cc1adacf38f2 (patch) (side-by-side diff)
treef358b16531551035a54c1dac95e16a36f86f8dc9
parent57d7f3faf053786925d2315e43ab6ba8d892f51a (diff)
downloadopie-f6a98984fcb0dfc7e176636560b7cc1adacf38f2.zip
opie-f6a98984fcb0dfc7e176636560b7cc1adacf38f2.tar.gz
opie-f6a98984fcb0dfc7e176636560b7cc1adacf38f2.tar.bz2
turn off silly casino rules solitare
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/solitaire/patiencecardgame.cpp13
-rw-r--r--noncore/games/solitaire/patiencecardgame.h31
2 files changed, 25 insertions, 19 deletions
diff --git a/noncore/games/solitaire/patiencecardgame.cpp b/noncore/games/solitaire/patiencecardgame.cpp
index 756577a..a1e4968 100644
--- a/noncore/games/solitaire/patiencecardgame.cpp
+++ b/noncore/games/solitaire/patiencecardgame.cpp
@@ -114,15 +114,15 @@ void PatienceCardGame::deal(void)
void PatienceCardGame::readConfig( Config& cfg )
{
cfg.setGroup("GameState");
+ deckTurns = cfg.readNumEntry("DeckTurns", 2500);
// Do we have a config file to read in?
- if ( !cfg.hasKey("numberOfTimesThroughDeck") )
- {
+ if ( !cfg.hasKey("numberOfTimesThroughDeck") ) {
// if not, create a new game
newGame();
return;
}
// We have a config file, lets read it in and use it
@@ -274,6 +274,15 @@ void PatienceCardGame::mousePress(QPoint p)
moved = TRUE;
}
}
+bool PatienceCardGame::canTurnOverDeck() {
+ return (numberOfTimesThroughDeck != deckTurns);
+}
+
+void PatienceCardGame::throughDeck() {
+ numberOfTimesThroughDeck++;
+ if (numberOfTimesThroughDeck == deckTurns)
+ circleCross->setCross();
+ }
diff --git a/noncore/games/solitaire/patiencecardgame.h b/noncore/games/solitaire/patiencecardgame.h
index 0d0e3d5..b76251a 100644
--- a/noncore/games/solitaire/patiencecardgame.h
+++ b/noncore/games/solitaire/patiencecardgame.h
@@ -15,13 +15,13 @@
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef PATIENCE_CARD_GAME_H
-#define PATIENCE_CARD_GAME_H
+#define PATIENCE_CARD_GAME_H
#include <qpopupmenu.h>
#include <qmainwindow.h>
#include <qintdict.h>
#include <qcanvas.h>
@@ -43,13 +43,13 @@ public:
}
virtual bool isAllowedToBeMoved(Card *card) {
Q_UNUSED(card);
//if ( ( !card->isFacing() ) && ( card == cardOnTop() ) )
if ( card == cardOnTop() )
return TRUE;
- return FALSE;
+ return FALSE;
}
};
class PatienceFaceUpDeck : public CardPile, public CanvasRoundRect
{
@@ -63,13 +63,13 @@ public:
}
virtual bool isAllowedToBeMoved(Card *card) {
Q_UNUSED(card);
//if ( ( card->isFacing() ) && ( card == cardOnTop() ) )
if ( card == cardOnTop() )
return TRUE;
- return FALSE;
+ return FALSE;
}
};
class PatienceDiscardPile : public CardPile, public CanvasRoundRect
{
@@ -80,18 +80,18 @@ public:
if ( card->isFacing() && ( card->getCardPile()->cardInfront(card) == NULL ) &&
( ( ( cardOnTop() == NULL ) && ( card->getValue() == ace ) ) ||
( ( cardOnTop() != NULL ) &&
( (int)card->getValue() == (int)cardOnTop()->getValue() + 1 ) &&
( card->getSuit() == cardOnTop()->getSuit() ) ) ) )
return TRUE;
- return FALSE;
+ return FALSE;
}
virtual bool isAllowedToBeMoved(Card *card) {
if ( card->isFacing() && ( card == cardOnTop() ) )
return TRUE;
- return FALSE;
+ return FALSE;
}
};
class PatienceWorkingPile : public CardPile, public CanvasRoundRect
{
@@ -102,18 +102,18 @@ public:
if ( card->isFacing() &&
( ( ( cardOnTop() == NULL ) && (card->getValue() == king) ) ||
( ( cardOnTop() != NULL ) &&
( (int)card->getValue() + 1 == (int)cardOnTop()->getValue() ) &&
( card->isRed() != cardOnTop()->isRed() ) ) ) )
return TRUE;
- return FALSE;
+ return FALSE;
}
virtual bool isAllowedToBeMoved(Card *card) {
if ( card->isFacing() )
return TRUE;
- return FALSE;
+ return FALSE;
}
virtual void cardAddedToTop(Card *card) {
Q_UNUSED(card);
top = getCardPos(NULL);
setNextX( top.x() );
setNextY( top.y() );
@@ -145,18 +145,18 @@ public:
virtual QPoint getCardPos(Card *c) {
int x = pileX, y = pileY;
Card *card = cardOnBottom();
while ((card != c) && (card != NULL)) {
if (card->isFacing()) {
int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13;
- y += offsetDown;
+ y += offsetDown;
} else {
- x += 1;
+ x += 1;
y += 3;
}
- card = cardInfront(card);
+ card = cardInfront(card);
}
return QPoint( x, y );
}
virtual QPoint getHypertheticalNextCardPos(void) {
return top;
// return QPoint( getNextX(), getNextY() );
@@ -170,30 +170,27 @@ private:
class PatienceCardGame : public CanvasCardGame
{
public:
PatienceCardGame(QCanvas *c, bool snap, QWidget *parent = 0);
virtual ~PatienceCardGame();
virtual void deal(void);
- virtual bool haveWeWon() {
+ int deckTurns;
+ virtual bool haveWeWon() {
return ( discardPiles[0]->kingOnTop() &&
discardPiles[1]->kingOnTop() &&
discardPiles[2]->kingOnTop() &&
discardPiles[3]->kingOnTop() );;
}
virtual void mousePress(QPoint p);
virtual void mouseRelease(QPoint p) { Q_UNUSED(p); }
// virtual void mouseMove(QPoint p);
virtual bool mousePressCard(Card *card, QPoint p);
virtual void mouseReleaseCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); }
// virtual void mouseMoveCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); }
- bool canTurnOverDeck(void) { return (numberOfTimesThroughDeck != 3); }
- void throughDeck(void) {
- numberOfTimesThroughDeck++;
- if (numberOfTimesThroughDeck == 3)
- circleCross->setCross();
- }
+ bool canTurnOverDeck();
+ void throughDeck();
bool snapOn;
virtual void writeConfig( Config& cfg );
virtual void readConfig( Config& cfg );
private:
CanvasCircleOrCross *circleCross;
CanvasRoundRect *rectangle;