summaryrefslogtreecommitdiff
Unidiff
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
@@ -273,113 +273,115 @@ void CanvasCardGame::contentsMouseMoveEvent(QMouseEvent *e) {
273 QPoint p = e->pos(); 273 QPoint p = e->pos();
274 274
275 if ( moving ) { 275 if ( moving ) {
276 276
277 moved = TRUE; 277 moved = TRUE;
278 278
279 if (moving->isFacing() != TRUE) 279 if (moving->isFacing() != TRUE)
280 return; 280 return;
281 281
282 int tx = (int)p.x() - cardXOff; 282 int tx = (int)p.x() - cardXOff;
283 int ty = (int)p.y() - cardYOff; 283 int ty = (int)p.y() - cardYOff;
284 284
285 if (snapOn == TRUE) { 285 if (snapOn == TRUE) {
286 CardPile *pile = closestPile( tx, ty, 50 ); 286 CardPile *pile = closestPile( tx, ty, 50 );
287 if ( pile && pile->isAllowedOnTop( moving ) ) { 287 if ( pile && pile->isAllowedOnTop( moving ) ) {
288 QPoint p = pile->getHypertheticalNextCardPos(); 288 QPoint p = pile->getHypertheticalNextCardPos();
289 if ( alphaCardPile ) 289 if ( alphaCardPile )
290 alphaCardPile->move( p.x(), p.y() ); 290 alphaCardPile->move( p.x(), p.y() );
291 return; 291 return;
292 } 292 }
293 } 293 }
294 294
295 if ( alphaCardPile ) 295 if ( alphaCardPile )
296 alphaCardPile->move( tx, ty ); 296 alphaCardPile->move( tx, ty );
297 } 297 }
298 298
299} 299}
300 300
301 301
302void CanvasCardGame::contentsMouseReleaseEvent(QMouseEvent *e) 302void CanvasCardGame::contentsMouseReleaseEvent(QMouseEvent *e)
303{ 303{
304 QPoint p = e->pos(); 304 QPoint p = e->pos();
305 305
306 Q_UNUSED(p); 306 Q_UNUSED(p);
307 307
308 if ( moving ) { 308 if ( moving ) {
309 309
310 CanvasCard *item = moving; 310 CanvasCard *item = moving;
311 311
312 if ( item->animated() ) 312 if ( item->animated() )
313 return; 313 return;
314 314
315 if ( alphaCardPile ) 315 if ( alphaCardPile )
316 if ( moved ) { 316 if ( moved ) {
317 317
318 CardPile *pile = closestPile((int)alphaCardPile->x(), (int)alphaCardPile->y(), 30); 318 CardPile *pile = closestPile((int)alphaCardPile->x(), (int)alphaCardPile->y(), 30);
319 319
320 if (pile && pile->isAllowedOnTop(item)) { 320 if (pile && pile->isAllowedOnTop(item)) {
321 CardPile *oldPile = item->getCardPile(); 321 CardPile *oldPile = item->getCardPile();
322 Card *c = NULL; 322 Card *c = NULL;
323 if ( oldPile != pile) { 323 if ( oldPile != pile) {
324 while ( item ) { 324 while ( item ) {
325 item->show(); 325 item->show();
326 if ( oldPile ) { 326 if ( oldPile ) {
327 c = oldPile->cardInfront(item); 327 c = oldPile->cardInfront(item);
328 oldPile->removeCard(item); 328 oldPile->removeCard(item);
329 } 329 }
330 pile->addCardToTop(item); 330 pile->addCardToTop(item);
331 item->setCardPile(pile); 331 item->setCardPile(pile);
332 //item->move( pile->getCardPos(item) ); 332 //item->move( pile->getCardPos(item) );
333 QPoint p = pile->getCardPos(item); 333 QPoint p = pile->getCardPos(item);
334 item->setPos( p.x(), p.y(), highestZ ); 334 item->setPos( p.x(), p.y(), highestZ );
335 highestZ++; 335 highestZ++;
336 336
337 if (item->getValue() == king && haveWeWon()) { 337 if (item->getValue() == king && haveWeWon()) {
338 alphaCardPile->hide(); 338 alphaCardPile->hide();
339 gameWon(); 339 gameWon();
340 moving = NULL; 340 moving = NULL;
341 return; 341 return;
342 } 342 }
343 343
344 if (oldPile) { 344 if (oldPile) {
345 item = (CanvasCard *)c; 345 item = (CanvasCard *)c;
346 } else { 346 } else {
347 item = NULL; 347 item = NULL;
348 } 348 }
349 } 349 }
350 alphaCardPile->hide(); 350 alphaCardPile->hide();
351 moving = NULL; 351 moving = NULL;
352 return; 352 return;
353 } 353 }
354 } 354 }
355 355
356 alphaCardPile->animatedMove(); 356 alphaCardPile->animatedMove();
357 } 357 }
358 } 358 }
359 359
360 moved = FALSE; 360 moved = FALSE;
361} 361}
362 362
363 363
364void CanvasCardGame::readPile( Config& cfg, CardPile *pile, QString name, int& highestZ ) 364void 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 for ( int i = 0; i < numberOfCards; i++ ) { 370 for ( int i = 0; i < numberOfCards; i++ ) {
370 QString cardStr; 371 QString cardStr;
371 cardStr.sprintf( "%i", i ); 372 cardStr.sprintf( "%i", i );
372 int val = cfg.readNumEntry( "Card" + cardStr ); 373 int val = cfg.readNumEntry( "Card" + cardStr );
373 bool facing = cfg.readBoolEntry( "CardFacing" + cardStr ); 374 bool facing = cfg.readBoolEntry( "CardFacing" + cardStr );
374 card = cards[ val ]; 375
376 card = cards[ val ];
375 card->setFace(facing); 377 card->setFace(facing);
376 pile->addCardToTop(card); 378 pile->addCardToTop(card);
377 card->setCardPile(pile); 379 card->setCardPile(pile);
378 QPoint p = pile->getCardPos( card ); 380 QPoint p = pile->getCardPos( card );
379 card->setPos( p.x(), p.y(), highestZ ); 381 card->setPos( p.x(), p.y(), highestZ );
380 card->showCard(); 382 card->showCard();
381 highestZ++; 383 highestZ++;
382 } 384 }
383} 385}
384 386
385 387
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
@@ -1,95 +1,96 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
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**********************************************************************/ 19**********************************************************************/
20#ifndef CANVAS_CARD_GAME_H 20#ifndef CANVAS_CARD_GAME_H
21#define CANVAS_CARD_GAME_H 21#define CANVAS_CARD_GAME_H
22 22
23#include "cardgame.h" 23#include "cardgame.h"
24#include "canvasshapes.h" 24#include "canvasshapes.h"
25#include "canvascard.h" 25#include "canvascard.h"
26 26
27#include <qpe/resource.h> 27#include <qpe/resource.h>
28#include <qpe/config.h> 28#include <qpe/config.h>
29 29
30#include <qmainwindow.h> 30#include <qmainwindow.h>
31#include <qpe/qpemenubar.h> 31#include <qpe/qpemenubar.h>
32#include <qpainter.h> 32#include <qpainter.h>
33 33
34#include <stdlib.h> 34#include <stdlib.h>
35#include <time.h> 35#include <time.h>
36 36
37 37
38class CanvasCardPile; 38class CanvasCardPile;
39 39
40 40
41class CanvasCardGame : public QCanvasView, public CardGame 41class CanvasCardGame : public QCanvasView, public CardGame
42{ 42{
43public: 43public:
44 CanvasCardGame(QCanvas &c, bool snap, QWidget *parent = 0, const char *name = 0, WFlags f = 0) : 44 CanvasCardGame(QCanvas &c, bool snap, QWidget *parent = 0, int numOfDecks = 1, const char *name = 0, WFlags f = 0) :
45 QCanvasView( &c, parent, name, f ), 45 QCanvasView( &c, parent, name, f ),
46 CardGame(0,numOfDecks),
46 moved(FALSE), 47 moved(FALSE),
47 moving(NULL), 48 moving(NULL),
48 alphaCardPile( NULL ), 49 alphaCardPile( NULL ),
49 cardXOff(0), cardYOff(0), 50 cardXOff(0), cardYOff(0),
50 snapOn(snap), 51 snapOn(snap),
51 numberToDraw(1) { } 52 numberToDraw(1) { }
52 53
53 virtual ~CanvasCardGame(); 54 virtual ~CanvasCardGame();
54 55
55 virtual Card *newCard( eValue v, eSuit s, bool f ) { 56 virtual Card *newCard( eValue v, eSuit s, bool f ) {
56 return new CanvasCard( v, s, f, canvas() ); 57 return new CanvasCard( v, s, f, canvas() );
57 } 58 }
58 59
59 virtual void readConfig( Config& cfg ) { Q_UNUSED( cfg ); } 60 virtual void readConfig( Config& cfg ) { Q_UNUSED( cfg ); }
60 virtual void writeConfig( Config& cfg ) { Q_UNUSED( cfg ); } 61 virtual void writeConfig( Config& cfg ) { Q_UNUSED( cfg ); }
61 62
62 virtual void gameWon(); 63 virtual void gameWon();
63 virtual bool haveWeWon() { return FALSE; } 64 virtual bool haveWeWon() { return FALSE; }
64 65
65 virtual bool mousePressCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); return FALSE; } 66 virtual bool mousePressCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); return FALSE; }
66 virtual void mouseReleaseCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); } 67 virtual void mouseReleaseCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); }
67 68
68 void cancelMoving() { moving = NULL; } 69 void cancelMoving() { moving = NULL; }
69 void toggleSnap() { snapOn = (snapOn == TRUE) ? FALSE : TRUE; } 70 void toggleSnap() { snapOn = (snapOn == TRUE) ? FALSE : TRUE; }
70 void toggleCardsDrawn() { numberToDraw = (numberToDraw == 1) ? 3 : 1; } 71 void toggleCardsDrawn() { numberToDraw = (numberToDraw == 1) ? 3 : 1; }
71 int cardsDrawn() { return numberToDraw; } 72 int cardsDrawn() { return numberToDraw; }
72 void setNumberToDraw(int numToDraw) { this->numberToDraw = numToDraw; } 73 void setNumberToDraw(int numToDraw) { this->numberToDraw = numToDraw; }
73 74
74 void readPile( Config& cfg, CardPile *pile, QString name, int& highestZ ); 75 void readPile( Config& cfg, CardPile *pile, QString name, int& highestZ );
75 76
76protected: 77protected:
77 void contentsMousePressEvent(QMouseEvent *e); 78 void contentsMousePressEvent(QMouseEvent *e);
78 void contentsMouseReleaseEvent(QMouseEvent *e); 79 void contentsMouseReleaseEvent(QMouseEvent *e);
79 void contentsMouseMoveEvent(QMouseEvent *e); 80 void contentsMouseMoveEvent(QMouseEvent *e);
80 81
81protected: 82protected:
82 // Mouse event state variables 83 // Mouse event state variables
83 bool moved; 84 bool moved;
84 CanvasCard *moving; 85 CanvasCard *moving;
85 CanvasCardPile *alphaCardPile; 86 CanvasCardPile *alphaCardPile;
86 int cardXOff, cardYOff; 87 int cardXOff, cardYOff;
87 88
88private: 89private:
89 bool snapOn; 90 bool snapOn;
90 int numberToDraw; 91 int numberToDraw;
91}; 92};
92 93
93 94
94#endif 95#endif
95 96
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,227 +1,280 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
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**********************************************************************/ 19**********************************************************************/
20 20
21#include "canvascardwindow.h" 21#include "canvascardwindow.h"
22#include "patiencecardgame.h" 22#include "patiencecardgame.h"
23#include "freecellcardgame.h" 23#include "freecellcardgame.h"
24#include "chicanecardgame.h"
25#include "harpcardgame.h"
24 26
25#include <qpe/resource.h> 27#include <qpe/resource.h>
26 28
27#include <qmainwindow.h> 29#include <qmainwindow.h>
28#include <qpopupmenu.h> 30#include <qpopupmenu.h>
29#include <qstyle.h> 31#include <qstyle.h>
30 32
31 33
32CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) : 34CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) :
33 QMainWindow(parent, name, f), canvas(230, 260), snapOn(TRUE), cardBack(4), gameType(0), 35 QMainWindow(parent, name, f), canvas(230, 260), snapOn(TRUE), cardBack(4), gameType(0),
34 cardGame(NULL) 36 cardGame(NULL)
35{ 37{
36 setIcon( Resource::loadPixmap( "cards" ) ); 38 setIcon( Resource::loadPixmap( "cards" ) );
37 39
38 // Create Playing Area for Games 40 // Create Playing Area for Games
39 if ( QPixmap::defaultDepth() < 12 ) { 41 if ( QPixmap::defaultDepth() < 12 ) {
40// canvas.setBackgroundColor(QColor(0x51, 0x74, 0x6B)); 42// canvas.setBackgroundColor(QColor(0x51, 0x74, 0x6B));
41 //canvas.setBackgroundColor(QColor(0x20, 0xb0, 0x50)); 43 //canvas.setBackgroundColor(QColor(0x20, 0xb0, 0x50));
42 canvas.setBackgroundColor(QColor(0x08, 0x98, 0x2D)); 44 canvas.setBackgroundColor(QColor(0x08, 0x98, 0x2D));
43 } else { 45 } else {
44 QPixmap bg; 46 QPixmap bg;
45 bg.convertFromImage( Resource::loadImage( "table_pattern" ), ThresholdDither ); 47 bg.convertFromImage( Resource::loadImage( "table_pattern" ), ThresholdDither );
46 canvas.setBackgroundPixmap(bg); 48 canvas.setBackgroundPixmap(bg);
47 } 49 }
48 50
49#if defined( QT_QWS_CASSIOPEIA ) 51#if defined( QT_QWS_CASSIOPEIA )
50 canvas.setAdvancePeriod(70); 52 canvas.setAdvancePeriod(70);
51#else 53#else
52 canvas.setAdvancePeriod(30); 54 canvas.setAdvancePeriod(30);
53#endif 55#endif
54 56
55 57
56#ifdef _PATIENCE_USE_ACCELS_ 58#ifdef _PATIENCE_USE_ACCELS_
57 QPEMenuBar* menu = menuBar(); 59 QPEMenuBar* menu = menuBar();
58 60
59 QPopupMenu* file = new QPopupMenu; 61 QPopupMenu* file = new QPopupMenu;
60 file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F); 62 file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F);
61 file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F); 63 file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F);
64 file->insertItem(tr("Chicane"), this, SLOT(initChicane()), CTRL+Key_F);
65 file->insertItem(tr("Harp"), this, SLOT(initHarp()), CTRL+Key_F);
62 menu->insertItem(tr("&Game"), file); 66 menu->insertItem(tr("&Game"), file);
63 67
64 menu->insertSeparator(); 68 menu->insertSeparator();
65 69
66 settings = new QPopupMenu; 70 settings = new QPopupMenu;
67 settings->insertItem(tr("&Change Card Backs"), this, SLOT(changeCardBacks()), Key_F2); 71 settings->insertItem(tr("&Change Card Backs"), this, SLOT(changeCardBacks()), Key_F2);
68 snap_id = settings->insertItem(tr("&Snap To Position"), this, SLOT(snapToggle()), Key_F3); 72 snap_id = settings->insertItem(tr("&Snap To Position"), this, SLOT(snapToggle()), Key_F3);
69 settings->setCheckable(TRUE); 73 settings->setCheckable(TRUE);
70 menu->insertItem(tr("&Settings"),settings); 74 menu->insertItem(tr("&Settings"),settings);
71 75
72 menu->insertSeparator(); 76 menu->insertSeparator();
73 77
74 QPopupMenu* help = new QPopupMenu; 78 QPopupMenu* help = new QPopupMenu;
75 help->insertItem(tr("&About"), this, SLOT(help()), Key_F1); 79 help->insertItem(tr("&About"), this, SLOT(help()), Key_F1);
76 help->setItemChecked(dbf_id, TRUE); 80 help->setItemChecked(dbf_id, TRUE);
77 menu->insertItem(tr("&Help"),help); 81 menu->insertItem(tr("&Help"),help);
78#else 82#else
79 QMenuBar* menu = menuBar(); 83 QMenuBar* menu = menuBar();
80 84
81 QPopupMenu* file = new QPopupMenu; 85 QPopupMenu* file = new QPopupMenu;
82 file->insertItem(tr("Patience"), this, SLOT(initPatience())); 86 file->insertItem(tr("Patience"), this, SLOT(initPatience()));
83 file->insertItem(tr("Freecell"), this, SLOT(initFreecell())); 87 file->insertItem(tr("Freecell"), this, SLOT(initFreecell()));
88 file->insertItem(tr("Chicane"), this, SLOT(initChicane()));
89 file->insertItem(tr("Harp"), this, SLOT(initHarp()));
84 menu->insertItem(tr("Play"), file); 90 menu->insertItem(tr("Play"), file);
85 91
86 menu->insertSeparator(); 92 menu->insertSeparator();
87 93
88 settings = new QPopupMenu; 94 settings = new QPopupMenu;
89 settings->setCheckable(TRUE); 95 settings->setCheckable(TRUE);
90 settings->insertItem(tr("Change Card Backs"), this, SLOT(changeCardBacks())); 96 settings->insertItem(tr("Change Card Backs"), this, SLOT(changeCardBacks()));
91 snap_id = settings->insertItem(tr("Snap To Position"), this, SLOT(snapToggle())); 97 snap_id = settings->insertItem(tr("Snap To Position"), this, SLOT(snapToggle()));
92 QString m; 98 QString m;
93 99
94 drawId = settings->insertItem(tr("Turn One Card"), this, SLOT(drawnToggle())); 100 drawId = settings->insertItem(tr("Turn One Card"), this, SLOT(drawnToggle()));
95 menu->insertItem(tr("Settings"),settings); 101 menu->insertItem(tr("Settings"),settings);
96 102
97#endif 103#endif
98 104
99 menu->show(); 105 menu->show();
100 106
101 Config cfg( "Patience" ); 107 Config cfg( "Patience" );
102 cfg.setGroup( "GlobalSettings" ); 108 cfg.setGroup( "GlobalSettings" );
103 snapOn = cfg.readBoolEntry( "SnapOn", TRUE); 109 snapOn = cfg.readBoolEntry( "SnapOn", TRUE);
104 settings->setItemChecked(snap_id, snapOn); 110 settings->setItemChecked(snap_id, snapOn);
105 gameType = cfg.readNumEntry( "GameType", -1 ); 111 gameType = cfg.readNumEntry( "GameType", -1 );
106 drawThree = cfg.readBoolEntry( "DrawThree", TRUE); 112 drawThree = cfg.readBoolEntry( "DrawThree", TRUE);
107 if ( gameType == 0 ) { 113 if ( gameType == 0 ) {
108 cardGame = new PatienceCardGame( &canvas, snapOn, this ); 114 cardGame = new PatienceCardGame( &canvas, snapOn, this );
109 cardGame->setNumberToDraw(drawThree ? 3 : 1); 115 cardGame->setNumberToDraw(drawThree ? 3 : 1);
110 setCaption(tr("Patience")); 116 setCaption(tr("Patience"));
111 setCentralWidget(cardGame); 117 setCentralWidget(cardGame);
112 cardGame->readConfig( cfg ); 118 cardGame->readConfig( cfg );
113 setCardBacks(); 119 setCardBacks();
114 } else if ( gameType == 1 ) { 120 } else if ( gameType == 1 ) {
115 cardGame = new FreecellCardGame( &canvas, snapOn, this ); 121 cardGame = new FreecellCardGame( &canvas, snapOn, this );
116 setCaption(tr("Freecell")); 122 setCaption(tr("Freecell"));
117 setCentralWidget(cardGame); 123 setCentralWidget(cardGame);
118 //cardGame->newGame(); // Until we know how to handle reading freecell config 124 //cardGame->newGame(); // Until we know how to handle reading freecell config
119 cardGame->readConfig( cfg ); 125 cardGame->readConfig( cfg );
120 setCardBacks(); 126 setCardBacks();
127 } else if ( gameType == 2 ) {
128 cardGame = new ChicaneCardGame( &canvas, snapOn, this );
129 cardGame->setNumberToDraw(1);
130 setCaption(tr("Chicane"));
131 setCentralWidget(cardGame);
132 //cardGame->newGame(); // Until we know how to handle reading freecell config
133 cardGame->readConfig( cfg );
134 setCardBacks();
135 } else if ( gameType == 3 ) {
136 cardGame = new HarpCardGame( &canvas, snapOn, this );
137 cardGame->setNumberToDraw(1);
138 setCaption(tr("Harp"));
139 setCentralWidget(cardGame);
140 //cardGame->newGame(); // Until we know how to handle reading freecell config
141 cardGame->readConfig( cfg );
142 setCardBacks();
121 } else { 143 } else {
122 // Probably there isn't a config file or it is broken 144 // Probably there isn't a config file or it is broken
123 // Start a new game 145 // Start a new game
124 initPatience(); 146 initPatience();
125 } 147 }
126 148
127 updateDraw(); 149 updateDraw();
128} 150}
129 151
130 152
131CanvasCardWindow::~CanvasCardWindow() 153CanvasCardWindow::~CanvasCardWindow()
132{ 154{
133 if (cardGame) { 155 if (cardGame) {
134 Config cfg("Patience"); 156 Config cfg("Patience");
135 cfg.setGroup( "GlobalSettings" ); 157 cfg.setGroup( "GlobalSettings" );
136 cfg.writeEntry( "GameType", gameType ); 158 cfg.writeEntry( "GameType", gameType );
137 cfg.writeEntry( "SnapOn", snapOn ); 159 cfg.writeEntry( "SnapOn", snapOn );
138 cfg.writeEntry( "DrawThree", drawThree); 160 cfg.writeEntry( "DrawThree", drawThree);
139 cardGame->writeConfig( cfg ); 161 cardGame->writeConfig( cfg );
140 delete cardGame; 162 delete cardGame;
141 } 163 }
142} 164}
143 165
144 166
145void CanvasCardWindow::resizeEvent(QResizeEvent *) 167void CanvasCardWindow::resizeEvent(QResizeEvent *)
146{ 168{
147 QSize s = centralWidget()->size(); 169 QSize s = centralWidget()->size();
148 int fw = style().defaultFrameWidth(); 170 int fw = style().defaultFrameWidth();
149 canvas.resize( s.width() - fw - 2, s.height() - fw - 2); 171 canvas.resize( s.width() - fw - 2, s.height() - fw - 2);
150} 172}
151 173
152 174
153void CanvasCardWindow::initPatience() 175void CanvasCardWindow::initPatience()
154{ 176{
155 // Create New Game 177 // Create New Game
156 if ( cardGame ) 178 if ( cardGame )
157 delete cardGame; 179 delete cardGame;
158 cardGame = new PatienceCardGame( &canvas, snapOn, this ); 180 cardGame = new PatienceCardGame( &canvas, snapOn, this );
159 cardGame->setNumberToDraw(drawThree ? 3 : 1); 181 cardGame->setNumberToDraw(drawThree ? 3 : 1);
160 gameType = 0; 182 gameType = 0;
161 setCaption(tr("Patience")); 183 setCaption(tr("Patience"));
162 setCentralWidget(cardGame); 184 setCentralWidget(cardGame);
163 cardGame->newGame(); 185 cardGame->newGame();
164 setCardBacks(); 186 setCardBacks();
165 updateDraw(); 187 updateDraw();
166} 188}
167 189
168 190
169void CanvasCardWindow::initFreecell() 191void CanvasCardWindow::initFreecell()
170{ 192{
171 // Create New Game 193 // Create New Game
172 if ( cardGame ) { 194 if ( cardGame ) {
173 delete cardGame; 195 delete cardGame;
174 } 196 }
175 cardGame = new FreecellCardGame( &canvas, snapOn, this ); 197 cardGame = new FreecellCardGame( &canvas, snapOn, this );
176 gameType = 1; 198 gameType = 1;
177 setCaption(tr("Freecell")); 199 setCaption(tr("Freecell"));
178 setCentralWidget(cardGame); 200 setCentralWidget(cardGame);
179 cardGame->newGame(); 201 cardGame->newGame();
180 setCardBacks(); 202 setCardBacks();
181} 203}
182 204
183 205
206void CanvasCardWindow::initChicane()
207{
208 // Create New Game
209 if ( cardGame ) {
210 delete cardGame;
211 }
212 cardGame = new ChicaneCardGame( &canvas, snapOn, this );
213 cardGame->setNumberToDraw(1);
214 gameType = 2;
215 setCaption(tr("Chicane"));
216 setCentralWidget(cardGame);
217 cardGame->newGame();
218 setCardBacks();
219}
220
221void CanvasCardWindow::initHarp()
222{
223 // Create New Game
224 if ( cardGame ) {
225 delete cardGame;
226 }
227 cardGame = new HarpCardGame( &canvas, snapOn, this );
228 cardGame->setNumberToDraw(1);
229 gameType = 3;
230 setCaption(tr("Harp"));
231 setCentralWidget(cardGame);
232 cardGame->newGame();
233 setCardBacks();
234}
235
236
184void CanvasCardWindow::snapToggle() 237void CanvasCardWindow::snapToggle()
185{ 238{
186 snapOn = !snapOn; 239 snapOn = !snapOn;
187 settings->setItemChecked(snap_id, snapOn); 240 settings->setItemChecked(snap_id, snapOn);
188 cardGame->toggleSnap(); 241 cardGame->toggleSnap();
189} 242}
190 243
191 244
192void CanvasCardWindow::drawnToggle() 245void CanvasCardWindow::drawnToggle()
193{ 246{
194 cardGame->toggleCardsDrawn(); 247 cardGame->toggleCardsDrawn();
195 updateDraw(); 248 updateDraw();
196} 249}
197 250
198void CanvasCardWindow::updateDraw() { 251void CanvasCardWindow::updateDraw() {
199 if(cardGame->cardsDrawn() == 3) 252 if(cardGame->cardsDrawn() == 3)
200 settings->changeItem(drawId, tr("Turn One Card")); 253 settings->changeItem(drawId, tr("Turn One Card"));
201 else 254 else
202 settings->changeItem(drawId, tr("Turn Three Cards")); 255 settings->changeItem(drawId, tr("Turn Three Cards"));
203} 256}
204 257
205 258
206void CanvasCardWindow::setCardBacks() 259void CanvasCardWindow::setCardBacks()
207{ 260{
208 QCanvasItemList l = canvas.allItems(); 261 QCanvasItemList l = canvas.allItems();
209 262
210 for (QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it) { 263 for (QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it) {
211 if ( (*it)->rtti() == canvasCardId ) 264 if ( (*it)->rtti() == canvasCardId )
212 ((CanvasCard *)(*it))->setCardBack( cardBack ); 265 ((CanvasCard *)(*it))->setCardBack( cardBack );
213 } 266 }
214} 267}
215 268
216 269
217void CanvasCardWindow::changeCardBacks() 270void CanvasCardWindow::changeCardBacks()
218{ 271{
219 cardBack++; 272 cardBack++;
220 273
221 if (cardBack == 5) 274 if (cardBack == 5)
222 cardBack = 0; 275 cardBack = 0;
223 276
224 setCardBacks(); 277 setCardBacks();
225} 278}
226 279
227 280
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
@@ -1,70 +1,72 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
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**********************************************************************/ 19**********************************************************************/
20#ifndef CANVAS_CARD_WINDOW_H 20#ifndef CANVAS_CARD_WINDOW_H
21#define CANVAS_CARD_WINDOW_H 21#define CANVAS_CARD_WINDOW_H
22 22
23 23
24#include <qmainwindow.h> 24#include <qmainwindow.h>
25#include <qcanvas.h> 25#include <qcanvas.h>
26 26
27 27
28class CanvasCardGame; 28class CanvasCardGame;
29class QPopupMenu; 29class QPopupMenu;
30 30
31 31
32class CanvasCardWindow : public QMainWindow { 32class CanvasCardWindow : public QMainWindow {
33 Q_OBJECT 33 Q_OBJECT
34 34
35public: 35public:
36 CanvasCardWindow(QWidget* parent=0, const char* name=0, WFlags f=0); 36 CanvasCardWindow(QWidget* parent=0, const char* name=0, WFlags f=0);
37 virtual ~CanvasCardWindow(); 37 virtual ~CanvasCardWindow();
38 38
39public slots: 39public slots:
40 void setCardBacks(); 40 void setCardBacks();
41 void changeCardBacks(); 41 void changeCardBacks();
42 void snapToggle(); 42 void snapToggle();
43 void drawnToggle(); 43 void drawnToggle();
44 44
45private slots: 45private slots:
46 void initFreecell(); 46 void initFreecell();
47 void initPatience(); 47 void initPatience();
48 void initChicane();
49 void initHarp();
48 50
49protected: 51protected:
50 virtual void resizeEvent(QResizeEvent *e); 52 virtual void resizeEvent(QResizeEvent *e);
51 53
52 void updateDraw(); 54 void updateDraw();
53private: 55private:
54 QCanvas canvas; 56 QCanvas canvas;
55 bool snapOn; 57 bool snapOn;
56 bool drawThree; 58 bool drawThree;
57 int drawId; 59 int drawId;
58 int cardBack; 60 int cardBack;
59 int gameType; 61 int gameType;
60 CanvasCardGame *cardGame; 62 CanvasCardGame *cardGame;
61 63
62 QPopupMenu* options; 64 QPopupMenu* options;
63 QPopupMenu* settings; 65 QPopupMenu* settings;
64 int dbf_id; 66 int dbf_id;
65 int snap_id; 67 int snap_id;
66}; 68};
67 69
68 70
69#endif 71#endif
70 72
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
@@ -1,84 +1,88 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
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**********************************************************************/ 19**********************************************************************/
20#ifndef CARD_H 20#ifndef CARD_H
21#define CARD_H 21#define CARD_H
22 22
23 23
24#include <qpoint.h> 24#include <qpoint.h>
25 25
26 26
27class CardPile; 27class CardPile;
28 28
29 29
30enum eSuit { 30enum eSuit {
31 jokerSuit = 0, clubs, spades, diamonds, hearts 31 jokerSuit = 0, clubs, spades, diamonds, hearts
32}; 32};
33 33
34 34
35enum eValue { 35enum eValue {
36 jokerVal = 0, ace, two, three, four, five, 36 jokerVal = 0, ace, two, three, four, five,
37 six, seven, eight, nine, ten, jack, queen, king 37 six, seven, eight, nine, ten, jack, queen, king
38}; 38};
39 39
40 40
41class Card 41class Card
42{ 42{
43public: 43public:
44 Card( eValue v, eSuit s, bool f ) : 44 Card( eValue v, eSuit s, bool f ) :
45 val(v), suit(s), faceUp(f), showing(FALSE), ix(0), iy(0), iz(0), cardPile(NULL) { } 45 val(v), suit(s), faceUp(f), showing(FALSE), ix(0), iy(0), iz(0), cardPile(NULL) { }
46 virtual ~Card() { } 46 virtual ~Card() { }
47 47
48 eValue getValue() { return val; } 48 eValue getValue() { return val; }
49 eSuit getSuit() { return suit; } 49 eSuit getSuit() { return suit; }
50 50
51 void setCardPile(CardPile *p) { cardPile = p; } 51 void setCardPile(CardPile *p) { cardPile = p; }
52 CardPile *getCardPile() { return cardPile; } 52 CardPile *getCardPile() { return cardPile; }
53 53
54 void setFace(bool f) { faceUp = f; /* flip(); */ } 54 void setFace(bool f) { faceUp = f; /* flip(); */ }
55 bool isFacing() { return faceUp; } 55 bool isFacing() { return faceUp; }
56 56
57 bool isShowing() { return showing; } 57 bool isShowing() { return showing; }
58 bool isRed() { return ((suit == diamonds) || (suit == hearts)); } 58 bool isRed() { return ((suit == diamonds) || (suit == hearts)); }
59 59
60 int getDeckNumber() { return deckNumber; }
61 void setDeckNumber(int n) { deckNumber=n; }
62
60 int getX(void) { return ix; } 63 int getX(void) { return ix; }
61 int getY(void) { return iy; } 64 int getY(void) { return iy; }
62 int getZ(void) { return iz; } 65 int getZ(void) { return iz; }
63 void flip(void) { flipTo(getX(), getY()); } 66 void flip(void) { flipTo(getX(), getY()); }
64 67
65 virtual void setPos(int x, int y, int z) { ix = x; iy = y; iz = z; } 68 virtual void setPos(int x, int y, int z) { ix = x; iy = y; iz = z; }
66 virtual void move(int x, int y) { ix = x; iy = y; } 69 virtual void move(int x, int y) { ix = x; iy = y; }
67 virtual void move(QPoint p) { ix = p.x(); iy = p.y(); } 70 virtual void move(QPoint p) { ix = p.x(); iy = p.y(); }
68 virtual void flipTo(int x, int y, int steps = 8) { ix = x; iy = y; faceUp = !faceUp; redraw(); Q_UNUSED(steps); } 71 virtual void flipTo(int x, int y, int steps = 8) { ix = x; iy = y; faceUp = !faceUp; redraw(); Q_UNUSED(steps); }
69 virtual void showCard(void) { showing = TRUE; } 72 virtual void showCard(void) { showing = TRUE; }
70 virtual void hideCard(void) { showing = FALSE; } 73 virtual void hideCard(void) { showing = FALSE; }
71protected: 74protected:
72 virtual void redraw(void) { } 75 virtual void redraw(void) { }
73private: 76private:
74 eValue val; 77 eValue val;
75 eSuit suit; 78 eSuit suit;
76 bool faceUp; 79 bool faceUp;
77 bool showing; 80 bool showing;
81 int deckNumber;
78 int ix, iy, iz; 82 int ix, iy, iz;
79 CardPile *cardPile; 83 CardPile *cardPile;
80}; 84};
81 85
82 86
83#endif 87#endif
84 88
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
@@ -1,81 +1,91 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
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**********************************************************************/ 19**********************************************************************/
20#include <stdlib.h> 20#include <stdlib.h>
21#include <time.h> 21#include <time.h>
22#include "card.h" 22#include "card.h"
23#include "carddeck.h" 23#include "carddeck.h"
24 24
25 25
26CardDeck::CardDeck(int jokers) : numberOfJokers(jokers), deckCreated(FALSE) 26CardDeck::CardDeck(int jokers, int numOfDecks) : numberOfJokers(jokers), numberOfDecks(numOfDecks), deckCreated(FALSE)
27{ 27{
28 cards = new (Card *)[getNumberOfCards()]; 28 cards = new (Card *)[getNumberOfCards()];
29} 29}
30 30
31 31
32CardDeck::~CardDeck() 32CardDeck::~CardDeck()
33{ 33{
34 for (int i = 0; i < getNumberOfCards(); i++) 34 for (int i = 0; i < getNumberOfCards(); i++)
35 delete cards[i]; 35 delete cards[i];
36 delete cards; 36 delete cards;
37} 37}
38 38
39 39
40void CardDeck::createDeck() 40void CardDeck::createDeck()
41{ 41{
42 if (!deckCreated) { 42 if (!deckCreated) {
43 for (int i = 0; i < 52; i++) 43 for (int j = 0; j < getNumberOfDecks(); j++) {
44 cards[i] = newCard( (eValue)((i % 13) + 1), (eSuit)((i / 13) + 1), FALSE ); 44 for (int i = 0; i < 52; i++) {
45 cards[i+j*52] = newCard( (eValue)((i % 13) + 1), (eSuit)((i / 13) + 1), FALSE);
46 cards[i+j*52]->setDeckNumber(j);
47 }
48 }
45 for (int i = 0; i < getNumberOfJokers(); i++) 49 for (int i = 0; i < getNumberOfJokers(); i++)
46 cards[52 + i] = newCard( jokerVal, jokerSuit, FALSE ); 50 cards[52*getNumberOfDecks() + i] = newCard( jokerVal, jokerSuit, FALSE);
47 deckCreated = TRUE; 51 deckCreated = TRUE;
48 } 52 }
49} 53}
50 54
51 55
52void CardDeck::shuffle() 56void CardDeck::shuffle()
53{ 57{
54 srand(time(NULL)); 58 srand(time(NULL));
55 for (int i = 0; i < getNumberOfCards(); i++) { 59 for (int i = 0; i < getNumberOfCards(); i++) {
56 int index = rand() % getNumberOfCards(); 60 int index = rand() % getNumberOfCards();
57 Card *tmpCard = cards[i]; 61 Card *tmpCard = cards[i];
58 cards[i] = cards[index]; 62 cards[i] = cards[index];
59 cards[index] = tmpCard; 63 cards[index] = tmpCard;
60 } 64 }
61} 65}
62 66
63 67
64int CardDeck::getNumberOfCards() 68int CardDeck::getNumberOfCards()
65{ 69{
66 return 52 + getNumberOfJokers(); 70 return 52*getNumberOfDecks() + getNumberOfJokers();
67} 71}
68 72
69 73
74int CardDeck::getNumberOfDecks()
75{
76 return numberOfDecks;
77}
78
79
70int CardDeck::getNumberOfJokers() 80int CardDeck::getNumberOfJokers()
71{ 81{
72 return numberOfJokers; 82 return numberOfJokers;
73} 83}
74 84
75 85
76Card *CardDeck::newCard( eValue v, eSuit s, bool f ) 86Card *CardDeck::newCard( eValue v, eSuit s, bool f)
77{ 87{
78 return new Card(v, s, f); 88 return new Card(v, s, f);
79} 89}
80 90
81 91
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
@@ -1,49 +1,51 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
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**********************************************************************/ 19**********************************************************************/
20#ifndef CARD_DECK_H 20#ifndef CARD_DECK_H
21#define CARD_DECK_H 21#define CARD_DECK_H
22 22
23 23
24class Card; 24class Card;
25 25
26 26
27class CardDeck 27class CardDeck
28{ 28{
29public: 29public:
30 CardDeck(int jokers = 0); 30 CardDeck(int jokers = 0, int numOfDecks = 1);
31 virtual ~CardDeck(); 31 virtual ~CardDeck();
32 32
33 void createDeck(); 33 void createDeck();
34 void shuffle(); 34 void shuffle();
35 int getNumberOfCards(); 35 int getNumberOfCards();
36 int getNumberOfDecks();
36 int getNumberOfJokers(); 37 int getNumberOfJokers();
37 38
38 virtual Card *newCard( eValue v, eSuit s, bool f ); 39 virtual Card *newCard( eValue v, eSuit s, bool f );
39 virtual void deal() { } 40 virtual void deal() { }
40 41
41 Card **cards; 42 Card **cards;
42private: 43private:
43 int numberOfJokers; 44 int numberOfJokers;
45 int numberOfDecks;
44 bool deckCreated; 46 bool deckCreated;
45}; 47};
46 48
47 49
48#endif 50#endif
49 51
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
@@ -1,45 +1,45 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
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**********************************************************************/ 19**********************************************************************/
20#ifndef CARD_GAME_H 20#ifndef CARD_GAME_H
21#define CARD_GAME_H 21#define CARD_GAME_H
22 22
23 23
24#include <qpoint.h> 24#include <qpoint.h>
25#include "card.h" 25#include "card.h"
26#include "cardpile.h" 26#include "cardpile.h"
27#include "carddeck.h" 27#include "carddeck.h"
28#include "cardgamelayout.h" 28#include "cardgamelayout.h"
29 29
30 30
31class CardGame : public CardGameLayout, public CardDeck 31class CardGame : public CardGameLayout, public CardDeck
32{ 32{
33public: 33public:
34 CardGame(int numOfJokers = 0) : CardGameLayout(), CardDeck(numOfJokers) { } 34 CardGame(int numOfJokers = 0, int numOfDecks = 1) : CardGameLayout(), CardDeck(numOfJokers,numOfDecks) { }
35 virtual ~CardGame() { } 35 virtual ~CardGame() { }
36 virtual void newGame(); 36 virtual void newGame();
37 virtual void mousePress(QPoint p) { Q_UNUSED(p); } 37 virtual void mousePress(QPoint p) { Q_UNUSED(p); }
38 virtual void mouseRelease(QPoint p) { Q_UNUSED(p); } 38 virtual void mouseRelease(QPoint p) { Q_UNUSED(p); }
39 virtual void mouseMove(QPoint p) { Q_UNUSED(p); } 39 virtual void mouseMove(QPoint p) { Q_UNUSED(p); }
40private: 40private:
41}; 41};
42 42
43 43
44#endif 44#endif
45 45
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
@@ -9,106 +9,106 @@
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 20
21#include "cardpile.h" 21#include "cardpile.h"
22#include "card.h" 22#include "card.h"
23 23
24#include <qpe/config.h> 24#include <qpe/config.h>
25#include <qpoint.h> 25#include <qpoint.h>
26 26
27#include <qlist.h> 27#include <qlist.h>
28 28
29 29
30CardPile::CardPile(int x, int y) : pileX(x), pileY(y), dealing(FALSE) { 30CardPile::CardPile(int x, int y) : pileX(x), pileY(y), dealing(FALSE) {
31 pileWidth = 0; 31 pileWidth = 0;
32 pileHeight = 0; 32 pileHeight = 0;
33 pileNextX = pileX; 33 pileNextX = pileX;
34 pileNextY = pileY; 34 pileNextY = pileY;
35 pileCenterX = x + pileWidth / 2; 35 pileCenterX = x + pileWidth / 2;
36 pileCenterY = y + pileHeight / 2; 36 pileCenterY = y + pileHeight / 2;
37 pileRadius = (pileWidth > pileHeight) ? pileWidth : pileHeight; 37 pileRadius = (pileWidth > pileHeight) ? pileWidth : pileHeight;
38} 38}
39 39
40 40
41int CardPile::distanceFromPile(int x, int y) { 41int CardPile::distanceFromPile(int x, int y) {
42 return (pileCenterX-x)*(pileCenterX-x)+(pileCenterY-y)*(pileCenterY-y); 42 return (pileCenterX-x)*(pileCenterX-x)+(pileCenterY-y)*(pileCenterY-y);
43} 43}
44 44
45 45
46int CardPile::distanceFromNextPos(int x, int y) { 46int CardPile::distanceFromNextPos(int x, int y) {
47 return (pileNextX-x)*(pileNextX-x)+(pileNextY-y)*(pileNextY-y); 47 return (pileNextX-x)*(pileNextX-x)+(pileNextY-y)*(pileNextY-y);
48} 48}
49 49
50 50
51Card *CardPile::cardInfront(Card *c) { 51Card *CardPile::cardInfront(Card *c) {
52 CardPile *p = c->getCardPile(); 52 CardPile *p = c->getCardPile();
53 if (p) { 53 if (p) {
54 p->at(p->find(c)); 54 p->at(p->find(c));
55 return p->next(); 55 return p->next();
56 } else { 56 } else {
57 return NULL; 57 return NULL;
58 } 58 }
59} 59}
60 60
61 61
62bool CardPile::kingOnTop() { 62bool CardPile::kingOnTop() {
63 Card *top = cardOnTop(); 63 Card *top = cardOnTop();
64 return top && top->getValue() == king; 64 return top && top->getValue() == king;
65} 65}
66 66
67 67
68bool CardPile::addCardToTop(Card *c) { 68bool CardPile::addCardToTop(Card *c) {
69 if (dealing || isAllowedOnTop(c)) { 69 if (dealing || isAllowedOnTop(c)) {
70 append((const Card *)c); 70 append((const Card *)c);
71 cardAddedToTop(c); 71 cardAddedToTop(c);
72 return TRUE; 72 return TRUE;
73 } 73 }
74 return FALSE; 74 return FALSE;
75} 75}
76 76
77 77
78bool CardPile::addCardToBottom(Card *c) { 78bool CardPile::addCardToBottom(Card *c) {
79 if (dealing || isAllowedOnBottom(c)) { 79 if (dealing || isAllowedOnBottom(c)) {
80 prepend((const Card *)c); 80 prepend((const Card *)c);
81 cardAddedToBottom(c); 81 cardAddedToBottom(c);
82 return TRUE; 82 return TRUE;
83 } 83 }
84 return FALSE; 84 return FALSE;
85} 85}
86 86
87 87
88bool CardPile::removeCard(Card *c) { 88bool CardPile::removeCard(Card *c) {
89 if (dealing || isAllowedToBeMoved(c)) { 89 if (dealing || isAllowedToBeMoved(c)) {
90 take(find(c)); 90 take(find(c));
91 cardRemoved(c); 91 cardRemoved(c);
92 return TRUE; 92 return TRUE;
93 } 93 }
94 return FALSE; 94 return FALSE;
95} 95}
96 96
97 97
98void CardPile::writeConfig( Config& cfg, QString name ) { 98void CardPile::writeConfig( Config& cfg, QString name ) {
99 int numberOfCards = 0; 99 int numberOfCards = 0;
100 cfg.setGroup( name ); 100 cfg.setGroup( name );
101 Card *card = cardOnBottom(); 101 Card *card = cardOnBottom();
102 while ( card ) { 102 while ( card ) {
103 QString cardStr; 103 QString cardStr;
104 cardStr.sprintf( "%i", numberOfCards ); 104 cardStr.sprintf( "%i", numberOfCards );
105 int val = (int)card->getValue() - 1 + ( (int)card->getSuit() - 1 ) * 13; 105 int val = (int)card->getValue()-1 + ((int)card->getSuit()-1)*13 + (int)card->getDeckNumber()*52;
106 cfg.writeEntry( "Card" + cardStr, val ); 106 cfg.writeEntry( "Card" + cardStr, val );
107 cfg.writeEntry( "CardFacing" + cardStr, card->isFacing() ); 107 cfg.writeEntry( "CardFacing" + cardStr, card->isFacing() );
108 card = cardInfront( card ); 108 card = cardInfront( card );
109 numberOfCards++; 109 numberOfCards++;
110 } 110 }
111 cfg.writeEntry("NumberOfCards", numberOfCards); 111 cfg.writeEntry("NumberOfCards", numberOfCards);
112} 112}
113 113
114 114
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 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**
20** Modified by C.A.Mader 2002
21**
22**********************************************************************/
23#include <qgfx_qws.h>
24#include "chicanecardgame.h"
25
26
27extern int highestZ;
28
29
30 ChicaneCardGame::ChicaneCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent, 2)// Use 2 Decks
31{
32 highestZ = 0;
33
34 for (int i = 0; i < 8; i++) {
35 discardPiles[i] = new ChicaneDiscardPile( 27 + i * 26, 10, canvas() );
36 addCardPile(discardPiles[i]);
37 }
38 for (int i = 0; i < 8; i++) {
39 workingPiles[i] = new ChicaneWorkingPile( 27 + i * 26, 50, canvas() );
40 addCardPile(workingPiles[i]);
41 }
42 faceDownDealingPile = new ChicaneFaceDownDeck( 2, 10, canvas() );
43}
44
45
46void ChicaneCardGame::deal(void)
47{
48 highestZ = 1;
49 int t = 0;
50
51 beginDealing();
52
53 for (int i = 0; i < 8; i++) {
54 for (int k = 0; k < 4; k++, t++) {
55 Card *card = cards[t];
56 workingPiles[i]->addCardToTop(card);
57 card->setCardPile( workingPiles[i] );
58 card->setPos( 0, 0, highestZ );
59 card->setFace(k==3);
60 card->move( workingPiles[i]->getCardPos( card ) );
61 card->showCard();
62 highestZ++;
63 }
64 }
65
66 for ( ; t < getNumberOfCards(); t++) {
67 Card *card = cards[t];
68 faceDownDealingPile->addCardToTop(card);
69 card->setCardPile( faceDownDealingPile );
70 QPoint p = faceDownDealingPile->getCardPos( card );
71 card->setPos( p.x(), p.y(), highestZ );
72 card->showCard();
73 highestZ++;
74 }
75
76 endDealing();
77}
78
79
80void ChicaneCardGame::readConfig( Config& cfg )
81{
82 cfg.setGroup("GameState");
83
84 // Create Cards, but don't shuffle or deal them yet
85 createDeck();
86
87 // Move the cards to their piles (deal them to their previous places)
88 beginDealing();
89
90 highestZ = 1;
91
92 for (int i = 0; i < 8; i++) {
93 QString pile;
94 pile.sprintf( "ChicaneDiscardPile%i", i );
95 readPile( cfg, discardPiles[i], pile, highestZ );
96 }
97
98 for (int i = 0; i < 8; i++) {
99 QString pile;
100 pile.sprintf( "ChicaneWorkingPile%i", i );
101 readPile( cfg, workingPiles[i], pile, highestZ );
102 }
103
104 readPile( cfg, faceDownDealingPile, "ChicaneFaceDownDealingPile", highestZ );
105
106 highestZ++;
107
108 endDealing();
109}
110
111
112void ChicaneCardGame::writeConfig( Config& cfg )
113{
114 cfg.setGroup("GameState");
115 for ( int i = 0; i < 8; i++ ) {
116 QString pile;
117 pile.sprintf( "ChicaneDiscardPile%i", i );
118 discardPiles[i]->writeConfig( cfg, pile );
119 }
120 for ( int i = 0; i < 8; i++ ) {
121 QString pile;
122 pile.sprintf( "ChicaneWorkingPile%i", i );
123 workingPiles[i]->writeConfig( cfg, pile );
124 }
125 faceDownDealingPile->writeConfig( cfg, "ChicaneFaceDownDealingPile" );
126}
127
128
129bool ChicaneCardGame::mousePressCard( Card *card, QPoint p )
130{
131 Q_UNUSED(p);
132
133 CanvasCard *item = (CanvasCard *)card;
134 if (item->isFacing() != TRUE) {
135 // From facedown stack
136 if ((item->x() == 2) && ((int)item->y() == 10)) { // Deal a row of 8 cards
137 // Move 8 cards, one to each workingPile
138 beginDealing();
139 for (int i=0; i<8 && faceDownDealingPile->cardOnTop(); i++) {
140 CanvasCard *card = (CanvasCard *)faceDownDealingPile->cardOnTop();
141 card->setZ(highestZ);
142 highestZ++;
143 faceDownDealingPile->removeCard(card);
144 workingPiles[i]->addCardToTop(card);
145 card->setCardPile( workingPiles[i] );
146 card->setFace(FALSE);
147 QPoint p = workingPiles[i]->getCardPos(card);
148 card->flipTo( p.x(), p.y() );
149 }
150 endDealing();
151 }
152 moving = NULL;
153 moved = FALSE;
154
155 return TRUE;
156 } else if ( !card->getCardPile()->isAllowedToBeMoved(card) ) {// Don't allow unclean columns to be moved
157 moving = NULL;
158 return TRUE;
159 }
160
161 return FALSE;
162}
163
164
165
166void ChicaneCardGame::mousePress(QPoint p)
167{
168 Q_UNUSED(p);
169}
170
171
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 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef CHICANE_CARD_GAME_H
21#define CHICANE_CARD_GAME_H
22
23
24#include "patiencecardgame.h"
25
26
27class ChicaneFaceDownDeck : public PatienceFaceDownDeck
28{
29public:
30 ChicaneFaceDownDeck(int x, int y, QCanvas *canvas) :
31 PatienceFaceDownDeck(x, y, canvas) { }
32
33};
34
35
36class ChicaneDiscardPile : public PatienceDiscardPile
37{
38public:
39 ChicaneDiscardPile(int x, int y, QCanvas *canvas) :
40 PatienceDiscardPile(x, y, canvas) { }
41
42};
43
44
45class ChicaneWorkingPile : public PatienceWorkingPile
46{
47public:
48 ChicaneWorkingPile(int x, int y, QCanvas *canvas) :
49 PatienceWorkingPile(x, y, canvas) { }
50
51 virtual bool isAllowedOnTop(Card *card) {
52 if ( card->isFacing() &&
53 // ( ( ( cardOnTop() == NULL ) && (card->getValue() == king) ) || // diese Zeile sorgt dafür dass nur Kings auf leere Plätze dürfen
54 ( (cardOnTop() == NULL) || // auf einen Freiplatz darf alles!
55 ( (cardOnTop() != NULL) &&
56 ((int)card->getValue() + 1 == (int)cardOnTop()->getValue()) &&
57 (card->isRed() != cardOnTop()->isRed()) ) ) )
58 return TRUE;
59 return FALSE;
60 }
61 virtual bool isAllowedToBeMoved(Card *card) {
62 if (!card->isFacing()) return FALSE;
63
64 int nextExpectedValue = (int)card->getValue();
65 bool nextExpectedColor = card->isRed();
66
67 while ((card != NULL)) {
68 if ( (int)card->getValue() != nextExpectedValue )
69 return FALSE;
70 if ( card->isRed() != nextExpectedColor )
71 return FALSE;
72 nextExpectedValue--;;
73 nextExpectedColor = !nextExpectedColor;
74 card = cardInfront(card);
75 }
76 return TRUE;
77 }
78
79 virtual void cardRemoved(Card *card) {
80 Q_UNUSED(card);
81
82 Card *newTopCard = cardOnTop();
83
84 if ( !newTopCard ) {
85 top = QPoint( pileX, pileY );
86 setNextX( pileX );
87 setNextY( pileY );
88 return;
89 } else {
90 top = getCardPos(NULL);
91 if ( newTopCard->isFacing() == FALSE ) {
92 int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13;
93 // correct the position taking in to account the card is not
94 // yet flipped, but will become flipped
95 top = QPoint( top.x(), top.y() - 3 ); // Keine Verschiebung!
96 newTopCard->flipTo( top.x(), top.y() );
97 top = QPoint( top.x(), top.y() + offsetDown );
98 }
99 setNextX( top.x() );
100 setNextY( top.y() );
101 }
102 }
103 virtual QPoint getCardPos(Card *c) {
104 int x = pileX, y = pileY;
105 Card *card = cardOnBottom();
106 while ((card != c) && (card != NULL)) {
107 if (card->isFacing()) {
108 int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13;
109 y += offsetDown;
110 } else {
111 x += 0; // Keine Verschiebung!
112 y += 3;
113 }
114 card = cardInfront(card);
115 }
116 return QPoint( x, y );
117 }
118
119 virtual QPoint getHypertheticalNextCardPos(void) {
120// return top;
121 return QPoint( getNextX(), getNextY() );
122 }
123
124private:
125 QPoint top;
126
127};
128
129
130class ChicaneCardGame : public CanvasCardGame
131{
132public:
133 ChicaneCardGame(QCanvas *c, bool snap, QWidget *parent = 0);
134// virtual ~ChicaneCardGame();
135 virtual void deal(void);
136 virtual bool haveWeWon() {
137 return ( discardPiles[0]->kingOnTop() &&
138 discardPiles[1]->kingOnTop() &&
139 discardPiles[2]->kingOnTop() &&
140 discardPiles[3]->kingOnTop() &&
141 discardPiles[4]->kingOnTop() &&
142 discardPiles[5]->kingOnTop() &&
143 discardPiles[6]->kingOnTop() &&
144 discardPiles[7]->kingOnTop() );;
145 }
146 virtual void mousePress(QPoint p);
147 virtual void mouseRelease(QPoint p) { Q_UNUSED(p); }
148// virtual void mouseMove(QPoint p);
149 virtual bool mousePressCard(Card *card, QPoint p);
150 virtual void mouseReleaseCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); }
151// virtual void mouseMoveCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); }
152 bool canTurnOverDeck(void) { return (FALSE); }
153 void throughDeck(void) { }
154 bool snapOn;
155 void writeConfig( Config& cfg );
156 void readConfig( Config& cfg );
157private:
158 ChicaneWorkingPile *workingPiles[8];
159 ChicaneDiscardPile *discardPiles[8];
160 ChicaneFaceDownDeck *faceDownDealingPile;
161};
162
163
164#endif
165
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 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**
20** Modified by C.A.Mader 2002
21**
22**********************************************************************/
23#include <qgfx_qws.h>
24#include "harpcardgame.h"
25
26
27extern int highestZ;
28
29
30 HarpCardGame::HarpCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent, 2)// Use 2 Decks
31{
32 highestZ = 0;
33
34 for (int i = 0; i < 8; i++) {
35 discardPiles[i] = new HarpDiscardPile( 27 + i * 26, 10, canvas() );
36 addCardPile(discardPiles[i]);
37 }
38 for (int i = 0; i < 8; i++) {
39 workingPiles[i] = new HarpWorkingPile( 27 + i * 26, 50, canvas() );
40 addCardPile(workingPiles[i]);
41 }
42 faceDownDealingPile = new HarpFaceDownDeck( 2, 10, canvas() );
43}
44
45
46void HarpCardGame::deal(void)
47{
48 highestZ = 1;
49 int t = 0;
50
51 beginDealing();
52
53 for (int i = 0; i < 8; i++) {
54 for (int k = 0; k < i+1; k++, t++) {
55 Card *card = cards[t];
56 workingPiles[i]->addCardToTop(card);
57 card->setCardPile( workingPiles[i] );
58 card->setPos( 0, 0, highestZ );
59 card->setFace(k==i);
60 card->move( workingPiles[i]->getCardPos( card ) );
61 card->showCard();
62 highestZ++;
63 }
64 }
65
66 for ( ; t < getNumberOfCards(); t++) {
67 Card *card = cards[t];
68 faceDownDealingPile->addCardToTop(card);
69 card->setCardPile( faceDownDealingPile );
70 QPoint p = faceDownDealingPile->getCardPos( card );
71 card->setPos( p.x(), p.y(), highestZ );
72 card->showCard();
73 highestZ++;
74 }
75
76 endDealing();
77}
78
79
80void HarpCardGame::readConfig( Config& cfg )
81{
82 cfg.setGroup("GameState");
83
84 // Create Cards, but don't shuffle or deal them yet
85 createDeck();
86
87 // Move the cards to their piles (deal them to their previous places)
88 beginDealing();
89
90 highestZ = 1;
91
92 for (int i = 0; i < 8; i++) {
93 QString pile;
94 pile.sprintf( "HarpDiscardPile%i", i );
95 readPile( cfg, discardPiles[i], pile, highestZ );
96 }
97
98 for (int i = 0; i < 8; i++) {
99 QString pile;
100 pile.sprintf( "HarpWorkingPile%i", i );
101 readPile( cfg, workingPiles[i], pile, highestZ );
102 }
103
104 readPile( cfg, faceDownDealingPile, "HarpFaceDownDealingPile", highestZ );
105
106 highestZ++;
107
108 endDealing();
109}
110
111
112void HarpCardGame::writeConfig( Config& cfg )
113{
114 cfg.setGroup("GameState");
115 for ( int i = 0; i < 8; i++ ) {
116 QString pile;
117 pile.sprintf( "HarpDiscardPile%i", i );
118 discardPiles[i]->writeConfig( cfg, pile );
119 }
120 for ( int i = 0; i < 8; i++ ) {
121 QString pile;
122 pile.sprintf( "HarpWorkingPile%i", i );
123 workingPiles[i]->writeConfig( cfg, pile );
124 }
125 faceDownDealingPile->writeConfig( cfg, "HarpFaceDownDealingPile" );
126}
127
128
129bool HarpCardGame::mousePressCard( Card *card, QPoint p )
130{
131 Q_UNUSED(p);
132
133 CanvasCard *item = (CanvasCard *)card;
134 if (item->isFacing() != TRUE) {
135 // From facedown stack
136 if ((item->x() == 2) && ((int)item->y() == 10)) { // Deal a row of 8 cards
137 // Move 8 cards, one to each workingPile
138 beginDealing();
139 for (int i=0; i<8 && faceDownDealingPile->cardOnTop(); i++) {
140 CanvasCard *card = (CanvasCard *)faceDownDealingPile->cardOnTop();
141 card->setZ(highestZ);
142 highestZ++;
143 faceDownDealingPile->removeCard(card);
144 workingPiles[i]->addCardToTop(card);
145 card->setCardPile( workingPiles[i] );
146 card->setFace(FALSE);
147 QPoint p = workingPiles[i]->getCardPos(card);
148 card->flipTo( p.x(), p.y() );
149 }
150 endDealing();
151 }
152 moving = NULL;
153 moved = FALSE;
154
155 return TRUE;
156 } else if ( !card->getCardPile()->isAllowedToBeMoved(card) ) {// Don't allow unclean columns to be moved
157 moving = NULL;
158 return TRUE;
159 }
160
161 return FALSE;
162}
163
164
165
166void HarpCardGame::mousePress(QPoint p)
167{
168 Q_UNUSED(p);
169}
170
171
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 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef HARP_CARD_GAME_H
21#define HARP_CARD_GAME_H
22
23
24#include "patiencecardgame.h"
25
26
27class HarpFaceDownDeck : public PatienceFaceDownDeck
28{
29public:
30 HarpFaceDownDeck(int x, int y, QCanvas *canvas) :
31 PatienceFaceDownDeck(x, y, canvas) { }
32
33};
34
35
36class HarpDiscardPile : public PatienceDiscardPile
37{
38public:
39 HarpDiscardPile(int x, int y, QCanvas *canvas) :
40 PatienceDiscardPile(x, y, canvas) { }
41
42};
43
44
45class HarpWorkingPile : public PatienceWorkingPile
46{
47public:
48 HarpWorkingPile(int x, int y, QCanvas *canvas) :
49 PatienceWorkingPile(x, y, canvas) { }
50
51 virtual bool isAllowedOnTop(Card *card) {
52 if ( card->isFacing() &&
53 // ( ( ( cardOnTop() == NULL ) && (card->getValue() == king) ) || // diese Zeile sorgt dafür dass nur Kings auf leere Plätze dürfen
54 ( (cardOnTop() == NULL) || // auf einen Freiplatz darf alles!
55 ( (cardOnTop() != NULL) &&
56 ((int)card->getValue() + 1 == (int)cardOnTop()->getValue()) &&
57 (card->isRed() != cardOnTop()->isRed()) ) ) )
58 return TRUE;
59 return FALSE;
60 }
61 virtual bool isAllowedToBeMoved(Card *card) {
62 if (!card->isFacing()) return FALSE;
63
64 int nextExpectedValue = (int)card->getValue();
65 bool nextExpectedColor = card->isRed();
66
67 while ((card != NULL)) {
68 if ( (int)card->getValue() != nextExpectedValue )
69 return FALSE;
70 if ( card->isRed() != nextExpectedColor )
71 return FALSE;
72 nextExpectedValue--;;
73 nextExpectedColor = !nextExpectedColor;
74 card = cardInfront(card);
75 }
76 return TRUE;
77 }
78
79 virtual void cardRemoved(Card *card) {
80 Q_UNUSED(card);
81
82 Card *newTopCard = cardOnTop();
83
84 if ( !newTopCard ) {
85 top = QPoint( pileX, pileY );
86 setNextX( pileX );
87 setNextY( pileY );
88 return;
89 } else {
90 top = getCardPos(NULL);
91 if ( newTopCard->isFacing() == FALSE ) {
92 int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13;
93 // correct the position taking in to account the card is not
94 // yet flipped, but will become flipped
95 top = QPoint( top.x(), top.y() - 3 ); // Keine Verschiebung!
96 newTopCard->flipTo( top.x(), top.y() );
97 top = QPoint( top.x(), top.y() + offsetDown );
98 }
99 setNextX( top.x() );
100 setNextY( top.y() );
101 }
102 }
103 virtual QPoint getCardPos(Card *c) {
104 int x = pileX, y = pileY;
105 Card *card = cardOnBottom();
106 while ((card != c) && (card != NULL)) {
107 if (card->isFacing()) {
108 int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13;
109 y += offsetDown;
110 } else {
111 x += 0; // Keine Verschiebung!
112 y += 3;
113 }
114 card = cardInfront(card);
115 }
116 return QPoint( x, y );
117 }
118
119 virtual QPoint getHypertheticalNextCardPos(void) {
120// return top;
121 return QPoint( getNextX(), getNextY() );
122 }
123
124private:
125 QPoint top;
126
127};
128
129
130class HarpCardGame : public CanvasCardGame
131{
132public:
133 HarpCardGame(QCanvas *c, bool snap, QWidget *parent = 0);
134// virtual ~HarpCardGame();
135 virtual void deal(void);
136 virtual bool haveWeWon() {
137 return ( discardPiles[0]->kingOnTop() &&
138 discardPiles[1]->kingOnTop() &&
139 discardPiles[2]->kingOnTop() &&
140 discardPiles[3]->kingOnTop() &&
141 discardPiles[4]->kingOnTop() &&
142 discardPiles[5]->kingOnTop() &&
143 discardPiles[6]->kingOnTop() &&
144 discardPiles[7]->kingOnTop() );;
145 }
146 virtual void mousePress(QPoint p);
147 virtual void mouseRelease(QPoint p) { Q_UNUSED(p); }
148// virtual void mouseMove(QPoint p);
149 virtual bool mousePressCard(Card *card, QPoint p);
150 virtual void mouseReleaseCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); }
151// virtual void mouseMoveCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); }
152 bool canTurnOverDeck(void) { return (FALSE); }
153 void throughDeck(void) { }
154 bool snapOn;
155 void writeConfig( Config& cfg );
156 void readConfig( Config& cfg );
157private:
158 HarpWorkingPile *workingPiles[8];
159 HarpDiscardPile *discardPiles[8];
160 HarpFaceDownDeck *faceDownDealingPile;
161};
162
163
164#endif
165
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
@@ -101,160 +101,158 @@ void PatienceCardGame::deal(void)
101 } 101 }
102 102
103 endDealing(); 103 endDealing();
104} 104}
105 105
106 106
107void PatienceCardGame::readConfig( Config& cfg ) 107void PatienceCardGame::readConfig( Config& cfg )
108{ 108{
109 cfg.setGroup("GameState"); 109 cfg.setGroup("GameState");
110 110
111 // Do we have a config file to read in? 111 // Do we have a config file to read in?
112 if ( !cfg.hasKey("numberOfTimesThroughDeck") ) { 112 if ( !cfg.hasKey("numberOfTimesThroughDeck") ) {
113 // if not, create a new game 113 // if not, create a new game
114 newGame(); 114 newGame();
115 return; 115 return;
116 } 116 }
117 // We have a config file, lets read it in and use it 117 // We have a config file, lets read it in and use it
118 118
119 // Create Cards, but don't shuffle or deal them yet 119 // Create Cards, but don't shuffle or deal them yet
120 createDeck(); 120 createDeck();
121 121
122 // How many times through the deck have we been 122 // How many times through the deck have we been
123 numberOfTimesThroughDeck = cfg.readNumEntry("NumberOfTimesThroughDeck"); 123 numberOfTimesThroughDeck = cfg.readNumEntry("NumberOfTimesThroughDeck");
124 124
125 // restore state to the circle/cross under the dealing pile 125 // restore state to the circle/cross under the dealing pile
126 if ( canTurnOverDeck() ) 126 if ( canTurnOverDeck() )
127 circleCross->setCircle(); 127 circleCross->setCircle();
128 else 128 else
129 circleCross->setCross(); 129 circleCross->setCross();
130 130
131 // Move the cards to their piles (deal them to their previous places) 131 // Move the cards to their piles (deal them to their previous places)
132 beginDealing(); 132 beginDealing();
133 133
134 highestZ = 1; 134 highestZ = 1;
135 135
136 for (int k = 0; k < 7; k++) { 136 for (int k = 0; k < 7; k++) {
137 QString pile; 137 QString pile;
138 pile.sprintf( "WorkingPile%i", k ); 138 pile.sprintf( "WorkingPile%i", k );
139 readPile( cfg, workingPiles[k], pile, highestZ ); 139 readPile( cfg, workingPiles[k], pile, highestZ );
140 } 140 }
141 141
142 for (int k = 0; k < 4; k++) { 142 for (int k = 0; k < 4; k++) {
143 QString pile; 143 QString pile;
144 pile.sprintf( "DiscardPile%i", k ); 144 pile.sprintf( "DiscardPile%i", k );
145 readPile( cfg, discardPiles[k], pile, highestZ ); 145 readPile( cfg, discardPiles[k], pile, highestZ );
146 } 146 }
147 147
148 readPile( cfg, faceDownDealingPile, "FaceDownDealingPile", highestZ ); 148 readPile( cfg, faceDownDealingPile, "FaceDownDealingPile", highestZ );
149 readPile( cfg, faceUpDealingPile, "FaceUpDealingPile", highestZ ); 149 readPile( cfg, faceUpDealingPile, "FaceUpDealingPile", highestZ );
150 150
151 highestZ++; 151 highestZ++;
152 152
153 endDealing(); 153 endDealing();
154} 154}
155 155
156 156
157void PatienceCardGame::writeConfig( Config& cfg ) 157void PatienceCardGame::writeConfig( Config& cfg )
158{ 158{
159 cfg.setGroup("GameState"); 159 cfg.setGroup("GameState");
160 cfg.writeEntry("numberOfTimesThroughDeck", numberOfTimesThroughDeck); 160 cfg.writeEntry("numberOfTimesThroughDeck", numberOfTimesThroughDeck);
161 161
162 for ( int i = 0; i < 7; i++ ) { 162 for ( int i = 0; i < 7; i++ ) {
163 QString pile; 163 QString pile;
164 pile.sprintf( "WorkingPile%i", i ); 164 pile.sprintf( "WorkingPile%i", i );
165 workingPiles[i]->writeConfig( cfg, pile ); 165 workingPiles[i]->writeConfig( cfg, pile );
166 } 166 }
167 for ( int i = 0; i < 4; i++ ) { 167 for ( int i = 0; i < 4; i++ ) {
168 QString pile; 168 QString pile;
169 pile.sprintf( "DiscardPile%i", i ); 169 pile.sprintf( "DiscardPile%i", i );
170 discardPiles[i]->writeConfig( cfg, pile ); 170 discardPiles[i]->writeConfig( cfg, pile );
171 } 171 }
172 faceDownDealingPile->writeConfig( cfg, "FaceDownDealingPile" ); 172 faceDownDealingPile->writeConfig( cfg, "FaceDownDealingPile" );
173 faceUpDealingPile->writeConfig( cfg, "FaceUpDealingPile" ); 173 faceUpDealingPile->writeConfig( cfg, "FaceUpDealingPile" );
174} 174}
175 175
176 176
177bool PatienceCardGame::mousePressCard( Card *card, QPoint p ) 177bool PatienceCardGame::mousePressCard( Card *card, QPoint p )
178{ 178{
179 Q_UNUSED(p); 179 Q_UNUSED(p);
180 180
181 CanvasCard *item = (CanvasCard *)card; 181 CanvasCard *item = (CanvasCard *)card;
182 if (item->isFacing() != TRUE) { 182 if (item->isFacing() != TRUE) {
183 // From facedown stack 183 // From facedown stack
184 if ((item->x() == 5) && ((int)item->y() == 10)) { 184 if ((item->x() == 5) && ((int)item->y() == 10)) {
185 item->setZ(highestZ); 185 item->setZ(highestZ);
186 highestZ++; 186 highestZ++;
187 187
188 // Added Code 188 // Added Code
189 faceDownDealingPile->removeCard(item); 189 faceDownDealingPile->removeCard(item);
190 faceUpDealingPile->addCardToTop(item); 190 faceUpDealingPile->addCardToTop(item);
191 item->setCardPile( faceUpDealingPile ); 191 item->setCardPile( faceUpDealingPile );
192 192
193 if ( qt_screen->deviceWidth() < 200 ) 193 if ( qt_screen->deviceWidth() < 200 )
194 item->flipTo( 30, (int)item->y() ); 194 item->flipTo( 30, (int)item->y() );
195 else 195 else
196 item->flipTo( 35, (int)item->y() ); 196 item->flipTo( 35, (int)item->y() );
197 } else { 197 } else return FALSE; // <- was missing, caused facedown card to react
198 // fix from cmader by tille 198 // to clicking, which is wrong
199 return false;
200 }
201 moving = NULL; 199 moving = NULL;
202 moved = FALSE; 200 moved = FALSE;
203 201
204 // move two other cards if we flip three at a time 202 // move two other cards if we flip three at a time
205 int flipped = 1; 203 int flipped = 1;
206 QCanvasItemList l = canvas()->collisions( p ); 204 QCanvasItemList l = canvas()->collisions( p );
207 for (QCanvasItemList::Iterator it = l.begin(); (it != l.end()) && (flipped != cardsDrawn()); ++it) { 205 for (QCanvasItemList::Iterator it = l.begin(); (it != l.end()) && (flipped != cardsDrawn()); ++it) {
208 if ( (*it)->rtti() == canvasCardId ) { 206 if ( (*it)->rtti() == canvasCardId ) {
209 CanvasCard *item = (CanvasCard *)*it; 207 CanvasCard *item = (CanvasCard *)*it;
210 if (item->animated()) 208 if (item->animated())
211 continue; 209 continue;
212 item->setZ(highestZ); 210 item->setZ(highestZ);
213 highestZ++; 211 highestZ++;
214 flipped++; 212 flipped++;
215 213
216 // Added Code 214 // Added Code
217 faceDownDealingPile->removeCard(item); 215 faceDownDealingPile->removeCard(item);
218 faceUpDealingPile->addCardToTop(item); 216 faceUpDealingPile->addCardToTop(item);
219 item->setCardPile( faceUpDealingPile ); 217 item->setCardPile( faceUpDealingPile );
220 218
221 if ( qt_screen->deviceWidth() < 200 ) 219 if ( qt_screen->deviceWidth() < 200 )
222 item->flipTo( 30, (int)item->y(), 8 * flipped ); 220 item->flipTo( 30, (int)item->y(), 8 * flipped );
223 else 221 else
224 item->flipTo( 35, (int)item->y(), 8 * flipped ); 222 item->flipTo( 35, (int)item->y(), 8 * flipped );
225 } 223 }
226 } 224 }
227 225
228 return TRUE; 226 return TRUE;
229 } 227 }
230 228
231 return FALSE; 229 return FALSE;
232} 230}
233 231
234 232
235void PatienceCardGame::mousePress(QPoint p) 233void PatienceCardGame::mousePress(QPoint p)
236{ 234{
237 if ( canTurnOverDeck() && 235 if ( canTurnOverDeck() &&
238 (p.x() > 5) && (p.x() < 28) && 236 (p.x() > 5) && (p.x() < 28) &&
239 (p.y() > 10) && (p.y() < 46) ) { 237 (p.y() > 10) && (p.y() < 46) ) {
240 238
241 beginDealing(); 239 beginDealing();
242 Card *card = faceUpDealingPile->cardOnTop(); 240 Card *card = faceUpDealingPile->cardOnTop();
243 while ( card ) { 241 while ( card ) {
244 card->setPos( 5, 10, highestZ ); 242 card->setPos( 5, 10, highestZ );
245 card->setFace( FALSE ); 243 card->setFace( FALSE );
246 faceUpDealingPile->removeCard( card ); 244 faceUpDealingPile->removeCard( card );
247 faceDownDealingPile->addCardToTop( card ); 245 faceDownDealingPile->addCardToTop( card );
248 card->setCardPile( faceDownDealingPile ); 246 card->setCardPile( faceDownDealingPile );
249 card = faceUpDealingPile->cardOnTop(); 247 card = faceUpDealingPile->cardOnTop();
250 highestZ++; 248 highestZ++;
251 } 249 }
252 endDealing(); 250 endDealing();
253 251
254 throughDeck(); 252 throughDeck();
255 253
256 moved = TRUE; 254 moved = TRUE;
257 } 255 }
258} 256}
259 257
260 258
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 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG += qt warn_on release 2 CONFIG += qt warn_on release
3 DESTDIR = $(OPIEDIR)/bin 3 DESTDIR = $(OPIEDIR)/bin
4 HEADERS = canvascard.h canvasshapes.h cardgame.h cardgamelayout.h cardpile.h card.h carddeck.h canvascardgame.h freecellcardgame.h patiencecardgame.h canvascardwindow.h 4
5 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 5 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
6
7 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
8
6 TARGET = patience 9 TARGET = patience
7INCLUDEPATH += $(OPIEDIR)/include 10INCLUDEPATH += $(OPIEDIR)/include
8 DEPENDPATH+= $(OPIEDIR)/include 11 DEPENDPATH+= $(OPIEDIR)/include
9LIBS += -lqpe 12LIBS += -lqpe
10 REQUIRES= patience 13 REQUIRES= patience
11 14
12TRANSLATIONS = ../../../i18n/de/patience.ts \ 15TRANSLATIONS = ../../../i18n/de/patience.ts \
13 ../../../i18n/en/patience.ts \ 16 ../../../i18n/en/patience.ts \
14 ../../../i18n/es/patience.ts \ 17 ../../../i18n/es/patience.ts \
15 ../../../i18n/fr/patience.ts \ 18 ../../../i18n/fr/patience.ts \
16 ../../../i18n/hu/patience.ts \ 19 ../../../i18n/hu/patience.ts \
17 ../../../i18n/ja/patience.ts \ 20 ../../../i18n/ja/patience.ts \
18 ../../../i18n/ko/patience.ts \ 21 ../../../i18n/ko/patience.ts \
19 ../../../i18n/no/patience.ts \ 22 ../../../i18n/no/patience.ts \
20 ../../../i18n/pl/patience.ts \ 23 ../../../i18n/pl/patience.ts \
21 ../../../i18n/pt/patience.ts \ 24 ../../../i18n/pt/patience.ts \
22 ../../../i18n/pt_BR/patience.ts \ 25 ../../../i18n/pt_BR/patience.ts \
23 ../../../i18n/sl/patience.ts \ 26 ../../../i18n/sl/patience.ts \
24 ../../../i18n/zh_CN/patience.ts \ 27 ../../../i18n/zh_CN/patience.ts \
25 ../../../i18n/zh_TW/patience.ts 28 ../../../i18n/zh_TW/patience.ts