summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/solitaire/canvascardgame.cpp4
-rw-r--r--noncore/games/solitaire/canvascardgame.h3
-rw-r--r--noncore/games/solitaire/canvascardwindow.cpp53
-rw-r--r--noncore/games/solitaire/canvascardwindow.h2
-rw-r--r--noncore/games/solitaire/card.h4
-rw-r--r--noncore/games/solitaire/carddeck.cpp22
-rw-r--r--noncore/games/solitaire/carddeck.h4
-rw-r--r--noncore/games/solitaire/cardgame.h2
-rw-r--r--noncore/games/solitaire/cardpile.cpp2
-rw-r--r--noncore/games/solitaire/chicanecardgame.cpp171
-rw-r--r--noncore/games/solitaire/chicanecardgame.h165
-rw-r--r--noncore/games/solitaire/harpcardgame.cpp171
-rw-r--r--noncore/games/solitaire/harpcardgame.h165
-rw-r--r--noncore/games/solitaire/patiencecardgame.cpp6
-rwxr-xr-xnoncore/games/solitaire/solitaire.pro7
15 files changed, 764 insertions, 17 deletions
diff --git a/noncore/games/solitaire/canvascardgame.cpp b/noncore/games/solitaire/canvascardgame.cpp
index ef35287..357e798 100644
--- a/noncore/games/solitaire/canvascardgame.cpp
+++ b/noncore/games/solitaire/canvascardgame.cpp
@@ -345,41 +345,43 @@ void CanvasCardGame::contentsMouseReleaseEvent(QMouseEvent *e)
item = (CanvasCard *)c;
} else {
item = NULL;
}
}
alphaCardPile->hide();
moving = NULL;
return;
}
}
alphaCardPile->animatedMove();
}
}
moved = FALSE;
}
void CanvasCardGame::readPile( Config& cfg, CardPile *pile, QString name, int& highestZ )
{
cfg.setGroup( name );
int numberOfCards = cfg.readNumEntry("NumberOfCards", 0);
Card *card = NULL;
+
for ( int i = 0; i < numberOfCards; i++ ) {
QString cardStr;
cardStr.sprintf( "%i", i );
int val = cfg.readNumEntry( "Card" + cardStr );
bool facing = cfg.readBoolEntry( "CardFacing" + cardStr );
- card = cards[ val ];
+
+ card = cards[ val ];
card->setFace(facing);
pile->addCardToTop(card);
card->setCardPile(pile);
QPoint p = pile->getCardPos( card );
card->setPos( p.x(), p.y(), highestZ );
card->showCard();
highestZ++;
}
}
diff --git a/noncore/games/solitaire/canvascardgame.h b/noncore/games/solitaire/canvascardgame.h
index 4d32014..0dfb85e 100644
--- a/noncore/games/solitaire/canvascardgame.h
+++ b/noncore/games/solitaire/canvascardgame.h
@@ -20,50 +20,51 @@
#ifndef CANVAS_CARD_GAME_H
#define CANVAS_CARD_GAME_H
#include "cardgame.h"
#include "canvasshapes.h"
#include "canvascard.h"
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qmainwindow.h>
#include <qpe/qpemenubar.h>
#include <qpainter.h>
#include <stdlib.h>
#include <time.h>
class CanvasCardPile;
class CanvasCardGame : public QCanvasView, public CardGame
{
public:
- CanvasCardGame(QCanvas &c, bool snap, QWidget *parent = 0, const char *name = 0, WFlags f = 0) :
+ CanvasCardGame(QCanvas &c, bool snap, QWidget *parent = 0, int numOfDecks = 1, const char *name = 0, WFlags f = 0) :
QCanvasView( &c, parent, name, f ),
+ CardGame(0,numOfDecks),
moved(FALSE),
moving(NULL),
alphaCardPile( NULL ),
cardXOff(0), cardYOff(0),
snapOn(snap),
numberToDraw(1) { }
virtual ~CanvasCardGame();
virtual Card *newCard( eValue v, eSuit s, bool f ) {
return new CanvasCard( v, s, f, canvas() );
}
virtual void readConfig( Config& cfg ) { Q_UNUSED( cfg ); }
virtual void writeConfig( Config& cfg ) { Q_UNUSED( cfg ); }
virtual void gameWon();
virtual bool haveWeWon() { return FALSE; }
virtual bool mousePressCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); return FALSE; }
virtual void mouseReleaseCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); }
void cancelMoving() { moving = NULL; }
void toggleSnap() { snapOn = (snapOn == TRUE) ? FALSE : TRUE; }
diff --git a/noncore/games/solitaire/canvascardwindow.cpp b/noncore/games/solitaire/canvascardwindow.cpp
index 4c365a5..e1c021e 100644
--- a/noncore/games/solitaire/canvascardwindow.cpp
+++ b/noncore/games/solitaire/canvascardwindow.cpp
@@ -1,144 +1,166 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** 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.
**
**********************************************************************/
#include "canvascardwindow.h"
#include "patiencecardgame.h"
#include "freecellcardgame.h"
+#include "chicanecardgame.h"
+#include "harpcardgame.h"
#include <qpe/resource.h>
#include <qmainwindow.h>
#include <qpopupmenu.h>
#include <qstyle.h>
CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) :
QMainWindow(parent, name, f), canvas(230, 260), snapOn(TRUE), cardBack(4), gameType(0),
cardGame(NULL)
{
setIcon( Resource::loadPixmap( "cards" ) );
// Create Playing Area for Games
if ( QPixmap::defaultDepth() < 12 ) {
// canvas.setBackgroundColor(QColor(0x51, 0x74, 0x6B));
// canvas.setBackgroundColor(QColor(0x20, 0xb0, 0x50));
canvas.setBackgroundColor(QColor(0x08, 0x98, 0x2D));
} else {
QPixmap bg;
bg.convertFromImage( Resource::loadImage( "table_pattern" ), ThresholdDither );
canvas.setBackgroundPixmap(bg);
}
#if defined( QT_QWS_CASSIOPEIA )
canvas.setAdvancePeriod(70);
#else
canvas.setAdvancePeriod(30);
#endif
#ifdef _PATIENCE_USE_ACCELS_
QPEMenuBar* menu = menuBar();
QPopupMenu* file = new QPopupMenu;
file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F);
file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F);
+ file->insertItem(tr("Chicane"), this, SLOT(initChicane()), CTRL+Key_F);
+ file->insertItem(tr("Harp"), this, SLOT(initHarp()), CTRL+Key_F);
menu->insertItem(tr("&Game"), file);
menu->insertSeparator();
settings = new QPopupMenu;
settings->insertItem(tr("&Change Card Backs"), this, SLOT(changeCardBacks()), Key_F2);
snap_id = settings->insertItem(tr("&Snap To Position"), this, SLOT(snapToggle()), Key_F3);
settings->setCheckable(TRUE);
menu->insertItem(tr("&Settings"),settings);
menu->insertSeparator();
QPopupMenu* help = new QPopupMenu;
help->insertItem(tr("&About"), this, SLOT(help()), Key_F1);
help->setItemChecked(dbf_id, TRUE);
menu->insertItem(tr("&Help"),help);
#else
QMenuBar* menu = menuBar();
QPopupMenu* file = new QPopupMenu;
file->insertItem(tr("Patience"), this, SLOT(initPatience()));
file->insertItem(tr("Freecell"), this, SLOT(initFreecell()));
+ file->insertItem(tr("Chicane"), this, SLOT(initChicane()));
+ file->insertItem(tr("Harp"), this, SLOT(initHarp()));
menu->insertItem(tr("Play"), file);
menu->insertSeparator();
settings = new QPopupMenu;
settings->setCheckable(TRUE);
settings->insertItem(tr("Change Card Backs"), this, SLOT(changeCardBacks()));
snap_id = settings->insertItem(tr("Snap To Position"), this, SLOT(snapToggle()));
QString m;
drawId = settings->insertItem(tr("Turn One Card"), this, SLOT(drawnToggle()));
menu->insertItem(tr("Settings"),settings);
#endif
menu->show();
Config cfg( "Patience" );
cfg.setGroup( "GlobalSettings" );
snapOn = cfg.readBoolEntry( "SnapOn", TRUE);
settings->setItemChecked(snap_id, snapOn);
gameType = cfg.readNumEntry( "GameType", -1 );
drawThree = cfg.readBoolEntry( "DrawThree", TRUE);
if ( gameType == 0 ) {
cardGame = new PatienceCardGame( &canvas, snapOn, this );
cardGame->setNumberToDraw(drawThree ? 3 : 1);
setCaption(tr("Patience"));
setCentralWidget(cardGame);
cardGame->readConfig( cfg );
setCardBacks();
} else if ( gameType == 1 ) {
cardGame = new FreecellCardGame( &canvas, snapOn, this );
setCaption(tr("Freecell"));
setCentralWidget(cardGame);
//cardGame->newGame(); // Until we know how to handle reading freecell config
cardGame->readConfig( cfg );
setCardBacks();
+ } else if ( gameType == 2 ) {
+ cardGame = new ChicaneCardGame( &canvas, snapOn, this );
+ cardGame->setNumberToDraw(1);
+ setCaption(tr("Chicane"));
+ setCentralWidget(cardGame);
+ //cardGame->newGame(); // Until we know how to handle reading freecell config
+ cardGame->readConfig( cfg );
+ setCardBacks();
+ } else if ( gameType == 3 ) {
+ cardGame = new HarpCardGame( &canvas, snapOn, this );
+ cardGame->setNumberToDraw(1);
+ setCaption(tr("Harp"));
+ setCentralWidget(cardGame);
+ //cardGame->newGame(); // Until we know how to handle reading freecell config
+ cardGame->readConfig( cfg );
+ setCardBacks();
} else {
// Probably there isn't a config file or it is broken
// Start a new game
initPatience();
}
updateDraw();
}
CanvasCardWindow::~CanvasCardWindow()
{
if (cardGame) {
Config cfg("Patience");
cfg.setGroup( "GlobalSettings" );
cfg.writeEntry( "GameType", gameType );
cfg.writeEntry( "SnapOn", snapOn );
cfg.writeEntry( "DrawThree", drawThree);
cardGame->writeConfig( cfg );
delete cardGame;
}
}
@@ -160,48 +182,79 @@ void CanvasCardWindow::initPatience()
gameType = 0;
setCaption(tr("Patience"));
setCentralWidget(cardGame);
cardGame->newGame();
setCardBacks();
updateDraw();
}
void CanvasCardWindow::initFreecell()
{
// Create New Game
if ( cardGame ) {
delete cardGame;
}
cardGame = new FreecellCardGame( &canvas, snapOn, this );
gameType = 1;
setCaption(tr("Freecell"));
setCentralWidget(cardGame);
cardGame->newGame();
setCardBacks();
}
+void CanvasCardWindow::initChicane()
+{
+ // Create New Game
+ if ( cardGame ) {
+ delete cardGame;
+ }
+ cardGame = new ChicaneCardGame( &canvas, snapOn, this );
+ cardGame->setNumberToDraw(1);
+ gameType = 2;
+ setCaption(tr("Chicane"));
+ setCentralWidget(cardGame);
+ cardGame->newGame();
+ setCardBacks();
+}
+
+void CanvasCardWindow::initHarp()
+{
+ // Create New Game
+ if ( cardGame ) {
+ delete cardGame;
+ }
+ cardGame = new HarpCardGame( &canvas, snapOn, this );
+ cardGame->setNumberToDraw(1);
+ gameType = 3;
+ setCaption(tr("Harp"));
+ setCentralWidget(cardGame);
+ cardGame->newGame();
+ setCardBacks();
+}
+
+
void CanvasCardWindow::snapToggle()
{
snapOn = !snapOn;
settings->setItemChecked(snap_id, snapOn);
cardGame->toggleSnap();
}
void CanvasCardWindow::drawnToggle()
{
cardGame->toggleCardsDrawn();
updateDraw();
}
void CanvasCardWindow::updateDraw() {
if(cardGame->cardsDrawn() == 3)
settings->changeItem(drawId, tr("Turn One Card"));
else
settings->changeItem(drawId, tr("Turn Three Cards"));
}
void CanvasCardWindow::setCardBacks()
{
diff --git a/noncore/games/solitaire/canvascardwindow.h b/noncore/games/solitaire/canvascardwindow.h
index b75d40a..aa76730 100644
--- a/noncore/games/solitaire/canvascardwindow.h
+++ b/noncore/games/solitaire/canvascardwindow.h
@@ -24,47 +24,49 @@
#include <qmainwindow.h>
#include <qcanvas.h>
class CanvasCardGame;
class QPopupMenu;
class CanvasCardWindow : public QMainWindow {
Q_OBJECT
public:
CanvasCardWindow(QWidget* parent=0, const char* name=0, WFlags f=0);
virtual ~CanvasCardWindow();
public slots:
void setCardBacks();
void changeCardBacks();
void snapToggle();
void drawnToggle();
private slots:
void initFreecell();
void initPatience();
+ void initChicane();
+ void initHarp();
protected:
virtual void resizeEvent(QResizeEvent *e);
void updateDraw();
private:
QCanvas canvas;
bool snapOn;
bool drawThree;
int drawId;
int cardBack;
int gameType;
CanvasCardGame *cardGame;
QPopupMenu* options;
QPopupMenu* settings;
int dbf_id;
int snap_id;
};
#endif
diff --git a/noncore/games/solitaire/card.h b/noncore/games/solitaire/card.h
index eb30d30..68ce425 100644
--- a/noncore/games/solitaire/card.h
+++ b/noncore/games/solitaire/card.h
@@ -36,49 +36,53 @@ enum eValue {
jokerVal = 0, ace, two, three, four, five,
six, seven, eight, nine, ten, jack, queen, king
};
class Card
{
public:
Card( eValue v, eSuit s, bool f ) :
val(v), suit(s), faceUp(f), showing(FALSE), ix(0), iy(0), iz(0), cardPile(NULL) { }
virtual ~Card() { }
eValue getValue() { return val; }
eSuit getSuit() { return suit; }
void setCardPile(CardPile *p) { cardPile = p; }
CardPile *getCardPile() { return cardPile; }
void setFace(bool f) { faceUp = f; /* flip(); */ }
bool isFacing() { return faceUp; }
bool isShowing() { return showing; }
bool isRed() { return ((suit == diamonds) || (suit == hearts)); }
+ int getDeckNumber() { return deckNumber; }
+ void setDeckNumber(int n) { deckNumber=n; }
+
int getX(void) { return ix; }
int getY(void) { return iy; }
int getZ(void) { return iz; }
void flip(void) { flipTo(getX(), getY()); }
virtual void setPos(int x, int y, int z) { ix = x; iy = y; iz = z; }
virtual void move(int x, int y) { ix = x; iy = y; }
virtual void move(QPoint p) { ix = p.x(); iy = p.y(); }
virtual void flipTo(int x, int y, int steps = 8) { ix = x; iy = y; faceUp = !faceUp; redraw(); Q_UNUSED(steps); }
virtual void showCard(void) { showing = TRUE; }
virtual void hideCard(void) { showing = FALSE; }
protected:
virtual void redraw(void) { }
private:
eValue val;
eSuit suit;
bool faceUp;
bool showing;
+ int deckNumber;
int ix, iy, iz;
CardPile *cardPile;
};
#endif
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
@@ -2,80 +2,90 @@
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** 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.
**
**********************************************************************/
#include <stdlib.h>
#include <time.h>
#include "card.h"
#include "carddeck.h"
-CardDeck::CardDeck(int jokers) : numberOfJokers(jokers), deckCreated(FALSE)
+CardDeck::CardDeck(int jokers, int numOfDecks) : numberOfJokers(jokers), numberOfDecks(numOfDecks), deckCreated(FALSE)
{
cards = new (Card *)[getNumberOfCards()];
}
CardDeck::~CardDeck()
{
for (int i = 0; i < getNumberOfCards(); i++)
delete cards[i];
delete cards;
}
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;
}
}
void CardDeck::shuffle()
{
srand(time(NULL));
for (int i = 0; i < getNumberOfCards(); i++) {
int index = rand() % getNumberOfCards();
Card *tmpCard = cards[i];
cards[i] = cards[index];
cards[index] = tmpCard;
}
}
int CardDeck::getNumberOfCards()
{
- return 52 + getNumberOfJokers();
+ return 52*getNumberOfDecks() + getNumberOfJokers();
}
+int CardDeck::getNumberOfDecks()
+{
+ return numberOfDecks;
+}
+
+
int CardDeck::getNumberOfJokers()
{
return numberOfJokers;
}
-Card *CardDeck::newCard( eValue v, eSuit s, bool f )
+Card *CardDeck::newCard( eValue v, eSuit s, bool f)
{
return new Card(v, s, f);
}
diff --git a/noncore/games/solitaire/carddeck.h b/noncore/games/solitaire/carddeck.h
index 9ad35a9..026834f 100644
--- a/noncore/games/solitaire/carddeck.h
+++ b/noncore/games/solitaire/carddeck.h
@@ -6,44 +6,46 @@
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** 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.
**
**********************************************************************/
#ifndef CARD_DECK_H
#define CARD_DECK_H
class Card;
class CardDeck
{
public:
- CardDeck(int jokers = 0);
+ CardDeck(int jokers = 0, int numOfDecks = 1);
virtual ~CardDeck();
void createDeck();
void shuffle();
int getNumberOfCards();
+ int getNumberOfDecks();
int getNumberOfJokers();
virtual Card *newCard( eValue v, eSuit s, bool f );
virtual void deal() { }
Card **cards;
private:
int numberOfJokers;
+ int numberOfDecks;
bool deckCreated;
};
#endif
diff --git a/noncore/games/solitaire/cardgame.h b/noncore/games/solitaire/cardgame.h
index dd7efab..2e37c7f 100644
--- a/noncore/games/solitaire/cardgame.h
+++ b/noncore/games/solitaire/cardgame.h
@@ -10,36 +10,36 @@
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** 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.
**
**********************************************************************/
#ifndef CARD_GAME_H
#define CARD_GAME_H
#include <qpoint.h>
#include "card.h"
#include "cardpile.h"
#include "carddeck.h"
#include "cardgamelayout.h"
class CardGame : public CardGameLayout, public CardDeck
{
public:
- CardGame(int numOfJokers = 0) : CardGameLayout(), CardDeck(numOfJokers) { }
+ CardGame(int numOfJokers = 0, int numOfDecks = 1) : CardGameLayout(), CardDeck(numOfJokers,numOfDecks) { }
virtual ~CardGame() { }
virtual void newGame();
virtual void mousePress(QPoint p) { Q_UNUSED(p); }
virtual void mouseRelease(QPoint p) { Q_UNUSED(p); }
virtual void mouseMove(QPoint p) { Q_UNUSED(p); }
private:
};
#endif
diff --git a/noncore/games/solitaire/cardpile.cpp b/noncore/games/solitaire/cardpile.cpp
index 0b738d2..3b15e93 100644
--- a/noncore/games/solitaire/cardpile.cpp
+++ b/noncore/games/solitaire/cardpile.cpp
@@ -81,34 +81,34 @@ bool CardPile::addCardToBottom(Card *c) {
cardAddedToBottom(c);
return TRUE;
}
return FALSE;
}
bool CardPile::removeCard(Card *c) {
if (dealing || isAllowedToBeMoved(c)) {
take(find(c));
cardRemoved(c);
return TRUE;
}
return FALSE;
}
void CardPile::writeConfig( Config& cfg, QString name ) {
int numberOfCards = 0;
cfg.setGroup( name );
Card *card = cardOnBottom();
while ( card ) {
QString cardStr;
cardStr.sprintf( "%i", numberOfCards );
- int val = (int)card->getValue() - 1 + ( (int)card->getSuit() - 1 ) * 13;
+ int val = (int)card->getValue()-1 + ((int)card->getSuit()-1)*13 + (int)card->getDeckNumber()*52;
cfg.writeEntry( "Card" + cardStr, val );
cfg.writeEntry( "CardFacing" + cardStr, card->isFacing() );
card = cardInfront( card );
numberOfCards++;
}
cfg.writeEntry("NumberOfCards", numberOfCards);
}
diff --git a/noncore/games/solitaire/chicanecardgame.cpp b/noncore/games/solitaire/chicanecardgame.cpp
new file mode 100644
index 0000000..a242419
--- a/dev/null
+++ b/noncore/games/solitaire/chicanecardgame.cpp
@@ -0,0 +1,171 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** 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
+**
+**********************************************************************/
+#include <qgfx_qws.h>
+#include "chicanecardgame.h"
+
+
+extern int highestZ;
+
+
+ChicaneCardGame::ChicaneCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent, 2) // Use 2 Decks
+{
+ highestZ = 0;
+
+ for (int i = 0; i < 8; i++) {
+ discardPiles[i] = new ChicaneDiscardPile( 27 + i * 26, 10, canvas() );
+ addCardPile(discardPiles[i]);
+ }
+ for (int i = 0; i < 8; i++) {
+ workingPiles[i] = new ChicaneWorkingPile( 27 + i * 26, 50, canvas() );
+ addCardPile(workingPiles[i]);
+ }
+ faceDownDealingPile = new ChicaneFaceDownDeck( 2, 10, canvas() );
+}
+
+
+void ChicaneCardGame::deal(void)
+{
+ highestZ = 1;
+ int t = 0;
+
+ beginDealing();
+
+ for (int i = 0; i < 8; i++) {
+ for (int k = 0; k < 4; k++, t++) {
+ Card *card = cards[t];
+ workingPiles[i]->addCardToTop(card);
+ card->setCardPile( workingPiles[i] );
+ card->setPos( 0, 0, highestZ );
+ card->setFace(k==3);
+ card->move( workingPiles[i]->getCardPos( card ) );
+ card->showCard();
+ highestZ++;
+ }
+ }
+
+ for ( ; t < getNumberOfCards(); t++) {
+ Card *card = cards[t];
+ faceDownDealingPile->addCardToTop(card);
+ card->setCardPile( faceDownDealingPile );
+ QPoint p = faceDownDealingPile->getCardPos( card );
+ card->setPos( p.x(), p.y(), highestZ );
+ card->showCard();
+ highestZ++;
+ }
+
+ endDealing();
+}
+
+
+void ChicaneCardGame::readConfig( Config& cfg )
+{
+ cfg.setGroup("GameState");
+
+ // Create Cards, but don't shuffle or deal them yet
+ createDeck();
+
+ // Move the cards to their piles (deal them to their previous places)
+ beginDealing();
+
+ highestZ = 1;
+
+ for (int i = 0; i < 8; i++) {
+ QString pile;
+ pile.sprintf( "ChicaneDiscardPile%i", i );
+ readPile( cfg, discardPiles[i], pile, highestZ );
+ }
+
+ for (int i = 0; i < 8; i++) {
+ QString pile;
+ pile.sprintf( "ChicaneWorkingPile%i", i );
+ readPile( cfg, workingPiles[i], pile, highestZ );
+ }
+
+ readPile( cfg, faceDownDealingPile, "ChicaneFaceDownDealingPile", highestZ );
+
+ highestZ++;
+
+ endDealing();
+}
+
+
+void ChicaneCardGame::writeConfig( Config& cfg )
+{
+ cfg.setGroup("GameState");
+ for ( int i = 0; i < 8; i++ ) {
+ QString pile;
+ pile.sprintf( "ChicaneDiscardPile%i", i );
+ discardPiles[i]->writeConfig( cfg, pile );
+ }
+ for ( int i = 0; i < 8; i++ ) {
+ QString pile;
+ pile.sprintf( "ChicaneWorkingPile%i", i );
+ workingPiles[i]->writeConfig( cfg, pile );
+ }
+ faceDownDealingPile->writeConfig( cfg, "ChicaneFaceDownDealingPile" );
+}
+
+
+bool ChicaneCardGame::mousePressCard( Card *card, QPoint p )
+{
+ Q_UNUSED(p);
+
+ CanvasCard *item = (CanvasCard *)card;
+ if (item->isFacing() != TRUE) {
+ // From facedown stack
+ if ((item->x() == 2) && ((int)item->y() == 10)) { // Deal a row of 8 cards
+ // Move 8 cards, one to each workingPile
+ beginDealing();
+ for (int i=0; i<8 && faceDownDealingPile->cardOnTop(); i++) {
+ CanvasCard *card = (CanvasCard *)faceDownDealingPile->cardOnTop();
+ card->setZ(highestZ);
+ highestZ++;
+ faceDownDealingPile->removeCard(card);
+ workingPiles[i]->addCardToTop(card);
+ card->setCardPile( workingPiles[i] );
+ card->setFace(FALSE);
+ QPoint p = workingPiles[i]->getCardPos(card);
+ card->flipTo( p.x(), p.y() );
+ }
+ endDealing();
+ }
+ moving = NULL;
+ moved = FALSE;
+
+ return TRUE;
+ } else if ( !card->getCardPile()->isAllowedToBeMoved(card) ) { // Don't allow unclean columns to be moved
+ moving = NULL;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+
+void ChicaneCardGame::mousePress(QPoint p)
+{
+ Q_UNUSED(p);
+}
+
+
diff --git a/noncore/games/solitaire/chicanecardgame.h b/noncore/games/solitaire/chicanecardgame.h
new file mode 100644
index 0000000..668f5f4
--- a/dev/null
+++ b/noncore/games/solitaire/chicanecardgame.h
@@ -0,0 +1,165 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** 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.
+**
+**********************************************************************/
+#ifndef CHICANE_CARD_GAME_H
+#define CHICANE_CARD_GAME_H
+
+
+#include "patiencecardgame.h"
+
+
+class ChicaneFaceDownDeck : public PatienceFaceDownDeck
+{
+public:
+ ChicaneFaceDownDeck(int x, int y, QCanvas *canvas) :
+ PatienceFaceDownDeck(x, y, canvas) { }
+
+};
+
+
+class ChicaneDiscardPile : public PatienceDiscardPile
+{
+public:
+ ChicaneDiscardPile(int x, int y, QCanvas *canvas) :
+ PatienceDiscardPile(x, y, canvas) { }
+
+};
+
+
+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) &&
+ ((int)card->getValue() + 1 == (int)cardOnTop()->getValue()) &&
+ (card->isRed() != cardOnTop()->isRed()) ) ) )
+ return TRUE;
+ return FALSE;
+ }
+ virtual bool isAllowedToBeMoved(Card *card) {
+ if (!card->isFacing()) return FALSE;
+
+ int nextExpectedValue = (int)card->getValue();
+ bool nextExpectedColor = card->isRed();
+
+ while ((card != NULL)) {
+ if ( (int)card->getValue() != nextExpectedValue )
+ return FALSE;
+ if ( card->isRed() != nextExpectedColor )
+ return FALSE;
+ nextExpectedValue--;;
+ nextExpectedColor = !nextExpectedColor;
+ card = cardInfront(card);
+ }
+ return TRUE;
+ }
+
+ virtual void cardRemoved(Card *card) {
+ Q_UNUSED(card);
+
+ Card *newTopCard = cardOnTop();
+
+ if ( !newTopCard ) {
+ top = QPoint( pileX, pileY );
+ setNextX( pileX );
+ setNextY( pileY );
+ return;
+ } 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!
+ newTopCard->flipTo( top.x(), top.y() );
+ top = QPoint( top.x(), top.y() + offsetDown );
+ }
+ setNextX( top.x() );
+ setNextY( top.y() );
+ }
+ }
+ 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;
+ } else {
+ x += 0; // Keine Verschiebung!
+ y += 3;
+ }
+ card = cardInfront(card);
+ }
+ return QPoint( x, y );
+ }
+
+ virtual QPoint getHypertheticalNextCardPos(void) {
+// return top;
+ return QPoint( getNextX(), getNextY() );
+ }
+
+private:
+ QPoint top;
+
+};
+
+
+class ChicaneCardGame : public CanvasCardGame
+{
+public:
+ ChicaneCardGame(QCanvas *c, bool snap, QWidget *parent = 0);
+// virtual ~ChicaneCardGame();
+ virtual void deal(void);
+ virtual bool haveWeWon() {
+ return ( discardPiles[0]->kingOnTop() &&
+ discardPiles[1]->kingOnTop() &&
+ discardPiles[2]->kingOnTop() &&
+ discardPiles[3]->kingOnTop() &&
+ discardPiles[4]->kingOnTop() &&
+ discardPiles[5]->kingOnTop() &&
+ discardPiles[6]->kingOnTop() &&
+ discardPiles[7]->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 (FALSE); }
+ void throughDeck(void) { }
+ bool snapOn;
+ void writeConfig( Config& cfg );
+ void readConfig( Config& cfg );
+private:
+ ChicaneWorkingPile *workingPiles[8];
+ ChicaneDiscardPile *discardPiles[8];
+ ChicaneFaceDownDeck *faceDownDealingPile;
+};
+
+
+#endif
+
diff --git a/noncore/games/solitaire/harpcardgame.cpp b/noncore/games/solitaire/harpcardgame.cpp
new file mode 100644
index 0000000..22715ec
--- a/dev/null
+++ b/noncore/games/solitaire/harpcardgame.cpp
@@ -0,0 +1,171 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** 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
+**
+**********************************************************************/
+#include <qgfx_qws.h>
+#include "harpcardgame.h"
+
+
+extern int highestZ;
+
+
+HarpCardGame::HarpCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent, 2) // Use 2 Decks
+{
+ highestZ = 0;
+
+ for (int i = 0; i < 8; i++) {
+ discardPiles[i] = new HarpDiscardPile( 27 + i * 26, 10, canvas() );
+ addCardPile(discardPiles[i]);
+ }
+ for (int i = 0; i < 8; i++) {
+ workingPiles[i] = new HarpWorkingPile( 27 + i * 26, 50, canvas() );
+ addCardPile(workingPiles[i]);
+ }
+ faceDownDealingPile = new HarpFaceDownDeck( 2, 10, canvas() );
+}
+
+
+void HarpCardGame::deal(void)
+{
+ highestZ = 1;
+ int t = 0;
+
+ beginDealing();
+
+ for (int i = 0; i < 8; i++) {
+ for (int k = 0; k < i+1; k++, t++) {
+ Card *card = cards[t];
+ workingPiles[i]->addCardToTop(card);
+ card->setCardPile( workingPiles[i] );
+ card->setPos( 0, 0, highestZ );
+ card->setFace(k==i);
+ card->move( workingPiles[i]->getCardPos( card ) );
+ card->showCard();
+ highestZ++;
+ }
+ }
+
+ for ( ; t < getNumberOfCards(); t++) {
+ Card *card = cards[t];
+ faceDownDealingPile->addCardToTop(card);
+ card->setCardPile( faceDownDealingPile );
+ QPoint p = faceDownDealingPile->getCardPos( card );
+ card->setPos( p.x(), p.y(), highestZ );
+ card->showCard();
+ highestZ++;
+ }
+
+ endDealing();
+}
+
+
+void HarpCardGame::readConfig( Config& cfg )
+{
+ cfg.setGroup("GameState");
+
+ // Create Cards, but don't shuffle or deal them yet
+ createDeck();
+
+ // Move the cards to their piles (deal them to their previous places)
+ beginDealing();
+
+ highestZ = 1;
+
+ for (int i = 0; i < 8; i++) {
+ QString pile;
+ pile.sprintf( "HarpDiscardPile%i", i );
+ readPile( cfg, discardPiles[i], pile, highestZ );
+ }
+
+ for (int i = 0; i < 8; i++) {
+ QString pile;
+ pile.sprintf( "HarpWorkingPile%i", i );
+ readPile( cfg, workingPiles[i], pile, highestZ );
+ }
+
+ readPile( cfg, faceDownDealingPile, "HarpFaceDownDealingPile", highestZ );
+
+ highestZ++;
+
+ endDealing();
+}
+
+
+void HarpCardGame::writeConfig( Config& cfg )
+{
+ cfg.setGroup("GameState");
+ for ( int i = 0; i < 8; i++ ) {
+ QString pile;
+ pile.sprintf( "HarpDiscardPile%i", i );
+ discardPiles[i]->writeConfig( cfg, pile );
+ }
+ for ( int i = 0; i < 8; i++ ) {
+ QString pile;
+ pile.sprintf( "HarpWorkingPile%i", i );
+ workingPiles[i]->writeConfig( cfg, pile );
+ }
+ faceDownDealingPile->writeConfig( cfg, "HarpFaceDownDealingPile" );
+}
+
+
+bool HarpCardGame::mousePressCard( Card *card, QPoint p )
+{
+ Q_UNUSED(p);
+
+ CanvasCard *item = (CanvasCard *)card;
+ if (item->isFacing() != TRUE) {
+ // From facedown stack
+ if ((item->x() == 2) && ((int)item->y() == 10)) { // Deal a row of 8 cards
+ // Move 8 cards, one to each workingPile
+ beginDealing();
+ for (int i=0; i<8 && faceDownDealingPile->cardOnTop(); i++) {
+ CanvasCard *card = (CanvasCard *)faceDownDealingPile->cardOnTop();
+ card->setZ(highestZ);
+ highestZ++;
+ faceDownDealingPile->removeCard(card);
+ workingPiles[i]->addCardToTop(card);
+ card->setCardPile( workingPiles[i] );
+ card->setFace(FALSE);
+ QPoint p = workingPiles[i]->getCardPos(card);
+ card->flipTo( p.x(), p.y() );
+ }
+ endDealing();
+ }
+ moving = NULL;
+ moved = FALSE;
+
+ return TRUE;
+ } else if ( !card->getCardPile()->isAllowedToBeMoved(card) ) { // Don't allow unclean columns to be moved
+ moving = NULL;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+
+void HarpCardGame::mousePress(QPoint p)
+{
+ Q_UNUSED(p);
+}
+
+
diff --git a/noncore/games/solitaire/harpcardgame.h b/noncore/games/solitaire/harpcardgame.h
new file mode 100644
index 0000000..d1733fd
--- a/dev/null
+++ b/noncore/games/solitaire/harpcardgame.h
@@ -0,0 +1,165 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** 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.
+**
+**********************************************************************/
+#ifndef HARP_CARD_GAME_H
+#define HARP_CARD_GAME_H
+
+
+#include "patiencecardgame.h"
+
+
+class HarpFaceDownDeck : public PatienceFaceDownDeck
+{
+public:
+ HarpFaceDownDeck(int x, int y, QCanvas *canvas) :
+ PatienceFaceDownDeck(x, y, canvas) { }
+
+};
+
+
+class HarpDiscardPile : public PatienceDiscardPile
+{
+public:
+ HarpDiscardPile(int x, int y, QCanvas *canvas) :
+ PatienceDiscardPile(x, y, canvas) { }
+
+};
+
+
+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) &&
+ ((int)card->getValue() + 1 == (int)cardOnTop()->getValue()) &&
+ (card->isRed() != cardOnTop()->isRed()) ) ) )
+ return TRUE;
+ return FALSE;
+ }
+ virtual bool isAllowedToBeMoved(Card *card) {
+ if (!card->isFacing()) return FALSE;
+
+ int nextExpectedValue = (int)card->getValue();
+ bool nextExpectedColor = card->isRed();
+
+ while ((card != NULL)) {
+ if ( (int)card->getValue() != nextExpectedValue )
+ return FALSE;
+ if ( card->isRed() != nextExpectedColor )
+ return FALSE;
+ nextExpectedValue--;;
+ nextExpectedColor = !nextExpectedColor;
+ card = cardInfront(card);
+ }
+ return TRUE;
+ }
+
+ virtual void cardRemoved(Card *card) {
+ Q_UNUSED(card);
+
+ Card *newTopCard = cardOnTop();
+
+ if ( !newTopCard ) {
+ top = QPoint( pileX, pileY );
+ setNextX( pileX );
+ setNextY( pileY );
+ return;
+ } 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!
+ newTopCard->flipTo( top.x(), top.y() );
+ top = QPoint( top.x(), top.y() + offsetDown );
+ }
+ setNextX( top.x() );
+ setNextY( top.y() );
+ }
+ }
+ 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;
+ } else {
+ x += 0; // Keine Verschiebung!
+ y += 3;
+ }
+ card = cardInfront(card);
+ }
+ return QPoint( x, y );
+ }
+
+ virtual QPoint getHypertheticalNextCardPos(void) {
+// return top;
+ return QPoint( getNextX(), getNextY() );
+ }
+
+private:
+ QPoint top;
+
+};
+
+
+class HarpCardGame : public CanvasCardGame
+{
+public:
+ HarpCardGame(QCanvas *c, bool snap, QWidget *parent = 0);
+// virtual ~HarpCardGame();
+ virtual void deal(void);
+ virtual bool haveWeWon() {
+ return ( discardPiles[0]->kingOnTop() &&
+ discardPiles[1]->kingOnTop() &&
+ discardPiles[2]->kingOnTop() &&
+ discardPiles[3]->kingOnTop() &&
+ discardPiles[4]->kingOnTop() &&
+ discardPiles[5]->kingOnTop() &&
+ discardPiles[6]->kingOnTop() &&
+ discardPiles[7]->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 (FALSE); }
+ void throughDeck(void) { }
+ bool snapOn;
+ void writeConfig( Config& cfg );
+ void readConfig( Config& cfg );
+private:
+ HarpWorkingPile *workingPiles[8];
+ HarpDiscardPile *discardPiles[8];
+ HarpFaceDownDeck *faceDownDealingPile;
+};
+
+
+#endif
+
diff --git a/noncore/games/solitaire/patiencecardgame.cpp b/noncore/games/solitaire/patiencecardgame.cpp
index fc91b26..1b38072 100644
--- a/noncore/games/solitaire/patiencecardgame.cpp
+++ b/noncore/games/solitaire/patiencecardgame.cpp
@@ -173,52 +173,50 @@ void PatienceCardGame::writeConfig( Config& cfg )
faceUpDealingPile->writeConfig( cfg, "FaceUpDealingPile" );
}
bool PatienceCardGame::mousePressCard( Card *card, QPoint p )
{
Q_UNUSED(p);
CanvasCard *item = (CanvasCard *)card;
if (item->isFacing() != TRUE) {
// From facedown stack
if ((item->x() == 5) && ((int)item->y() == 10)) {
item->setZ(highestZ);
highestZ++;
// Added Code
faceDownDealingPile->removeCard(item);
faceUpDealingPile->addCardToTop(item);
item->setCardPile( faceUpDealingPile );
if ( qt_screen->deviceWidth() < 200 )
item->flipTo( 30, (int)item->y() );
else
item->flipTo( 35, (int)item->y() );
- } else {
- // fix from cmader by tille
- return false;
- }
+ } else return FALSE; // <- was missing, caused facedown card to react
+ // to clicking, which is wrong
moving = NULL;
moved = FALSE;
// move two other cards if we flip three at a time
int flipped = 1;
QCanvasItemList l = canvas()->collisions( p );
for (QCanvasItemList::Iterator it = l.begin(); (it != l.end()) && (flipped != cardsDrawn()); ++it) {
if ( (*it)->rtti() == canvasCardId ) {
CanvasCard *item = (CanvasCard *)*it;
if (item->animated())
continue;
item->setZ(highestZ);
highestZ++;
flipped++;
// Added Code
faceDownDealingPile->removeCard(item);
faceUpDealingPile->addCardToTop(item);
item->setCardPile( faceUpDealingPile );
if ( qt_screen->deviceWidth() < 200 )
item->flipTo( 30, (int)item->y(), 8 * flipped );
else
item->flipTo( 35, (int)item->y(), 8 * flipped );
diff --git a/noncore/games/solitaire/solitaire.pro b/noncore/games/solitaire/solitaire.pro
index 01d87ed..b2ba5aa 100755
--- a/noncore/games/solitaire/solitaire.pro
+++ b/noncore/games/solitaire/solitaire.pro
@@ -1,25 +1,28 @@
TEMPLATE = app
CONFIG += qt warn_on release
DESTDIR = $(OPIEDIR)/bin
-HEADERS = canvascard.h canvasshapes.h cardgame.h cardgamelayout.h cardpile.h card.h carddeck.h canvascardgame.h freecellcardgame.h patiencecardgame.h canvascardwindow.h
-SOURCES = canvascard.cpp canvasshapes.cpp cardgame.cpp cardgamelayout.cpp cardpile.cpp card.cpp carddeck.cpp canvascardgame.cpp freecellcardgame.cpp patiencecardgame.cpp canvascardwindow.cpp main.cpp
+
+HEADERS = canvascard.h canvasshapes.h cardgame.h cardgamelayout.h cardpile.h card.h carddeck.h canvascardgame.h freecellcardgame.h chicanecardgame.h harpcardgame.h patiencecardgame.h canvascardwindow.h
+
+SOURCES = canvascard.cpp canvasshapes.cpp cardgame.cpp cardgamelayout.cpp cardpile.cpp card.cpp carddeck.cpp canvascardgame.cpp freecellcardgame.cpp chicanecardgame.cpp harpcardgame.cpp patiencecardgame.cpp canvascardwindow.cpp main.cpp
+
TARGET = patience
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe
REQUIRES = patience
TRANSLATIONS = ../../../i18n/de/patience.ts \
../../../i18n/en/patience.ts \
../../../i18n/es/patience.ts \
../../../i18n/fr/patience.ts \
../../../i18n/hu/patience.ts \
../../../i18n/ja/patience.ts \
../../../i18n/ko/patience.ts \
../../../i18n/no/patience.ts \
../../../i18n/pl/patience.ts \
../../../i18n/pt/patience.ts \
../../../i18n/pt_BR/patience.ts \
../../../i18n/sl/patience.ts \
../../../i18n/zh_CN/patience.ts \
../../../i18n/zh_TW/patience.ts