Registered Member
|
I have made a patch to add an option to show all stack cards.
I wouldn't say this makes the game any easier. It do make the game more predicable and with less guess work. I think it makes the game more enjoyable, especially with 4-suites. *** spider.cpp --- spider.cpp *************** *** 137,148 **** else options->setCurrentItem( 2 ); connect( options, SIGNAL(triggered(int)), SLOT(gameTypeChanged()) ); } QList<QAction*> Spider::configActions() const { ! return QList<QAction*>() << options; } --- 137,157 ---- else options->setCurrentItem( 2 ); connect( options, SIGNAL(triggered(int)), SLOT(gameTypeChanged()) ); + + stackFaceupOption = new KSelectAction(i18n("S&tack Options"), this ); + stackFaceupOption->addAction( i18n("Face Down (harder)") ); + stackFaceupOption->addAction( i18n("Face Up (Easier)") ); + if ( openStack ) + stackFaceupOption->setCurrentItem( 1 ); + else + stackFaceupOption->setCurrentItem( 0 ); + connect( stackFaceupOption, SIGNAL(triggered(int)), SLOT(gameTypeChanged()) ); } QList<QAction*> Spider::configActions() const { ! return QList<QAction*>() << options << stackFaceupOption; } *************** *** 158,163 **** --- 167,178 ---- setSuits( 2 ); else setSuits( 4 ); + + if ( stackFaceupOption->currentItem() == 0 ) + openStack = false; + else + openStack = true; + startNew( gameNumber() ); } else *************** *** 170,175 **** --- 185,195 ---- options->setCurrentItem( 1 ); else options->setCurrentItem( 2 ); + + if ( openStack ) + stackFaceupOption->setCurrentItem( 1 ); + else + stackFaceupOption->setCurrentItem( 0 ); } } *************** *** 303,309 **** // deal face down cards (5 to first 4 piles, 4 to last 6) for ( int i = 0; i < 44; ++i ) { ! addCardForDeal( stack[column], cardList.takeLast(), false, randomPos() ); column = (column + 1) % 10; } // deal face up cards, one to each pile --- 323,329 ---- // deal face down cards (5 to first 4 piles, 4 to last 6) for ( int i = 0; i < 44; ++i ) { ! addCardForDeal( stack[column], cardList.takeLast(), openStack, randomPos() ); column = (column + 1) % 10; } // deal face up cards, one to each pile *** spider.h --- spider.h *************** *** 86,91 **** --- 86,95 ---- KSelectAction *options; + KSelectAction *stackFaceupOption; + + bool openStack; + friend class SpiderSolver; }; |
|
|
Registered Member
|
Here's an update to the patch, to make the stack cards face up game option persistent.
############################################################## --- kpat.kcfg +++ kpat.kcfg @@ -29,5 +29,8 @@ <entry name="SpiderSuitCount" key="SpiderSuits" type="Int"> <default>2</default> </entry> + <entry name="SpiderStackFaceup" key="SpiderStackFaceup" type="Int"> + <default>0</default> + </entry> </group> </kcfg> --- spider.cpp +++ spider.cpp @@ -75,6 +75,8 @@ m_suits = Settings::spiderSuitCount(); + stackFaceup = Settings::spiderStackFaceup(); + createDeck(); // Dealing the cards out into 5 piles so the user can see how many @@ -137,12 +139,19 @@ else options->setCurrentItem( 2 ); connect( options, SIGNAL(triggered(int)), SLOT(gameTypeChanged()) ); + + stackFaceupOption = new KSelectAction(i18n("S&tack Options"), this ); + stackFaceupOption->addAction( i18n("Face Down (harder)") ); + stackFaceupOption->addAction( i18n("Face Up (easier)") ); + stackFaceupOption->setCurrentItem( stackFaceup ); + + connect( stackFaceupOption, SIGNAL(triggered(int)), SLOT(gameTypeChanged()) ); } QList<QAction*> Spider::configActions() const { - return QList<QAction*>() << options; + return QList<QAction*>() << options << stackFaceupOption; } @@ -158,6 +167,12 @@ setSuits( 2 ); else setSuits( 4 ); + + if ( stackFaceup != stackFaceupOption->currentItem() ) { + stackFaceup = stackFaceupOption->currentItem(); + Settings::setSpiderStackFaceup(stackFaceup); + } + startNew( gameNumber() ); } else @@ -170,6 +185,9 @@ options->setCurrentItem( 1 ); else options->setCurrentItem( 2 ); + + stackFaceupOption->setCurrentItem( stackFaceup ); + } } @@ -303,7 +321,7 @@ // deal face down cards (5 to first 4 piles, 4 to last 6) for ( int i = 0; i < 44; ++i ) { - addCardForDeal( stack[column], cardList.takeLast(), false, randomPos() ); + addCardForDeal( stack[column], cardList.takeLast(), stackFaceup==1, randomPos() ); column = (column + 1) % 10; } // deal face up cards, one to each pile --- spider.h +++ spider.h @@ -86,6 +86,10 @@ KSelectAction *options; + KSelectAction *stackFaceupOption; + + int stackFaceup; + friend class SpiderSolver; }; |
|
Patches belong to reviewboard or at least bugs.kde.org
The KPatience maintainer will most likely miss it here. |
Registered users: Baidu [Spider], Bing [Bot], Google [Bot]