summaryrefslogtreecommitdiff
path: root/apps/plugins/solitaire.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-04-23 14:15:07 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-04-23 14:15:07 +0000
commit77a868360f9aac124a6cb368c83d66b31c596ae9 (patch)
treee3d5307b6ed99c2bc707c9a3347ab417223509dd /apps/plugins/solitaire.c
parent1245d0fddd4dfa1de756fcec484985cc24043be3 (diff)
downloadrockbox-77a868360f9aac124a6cb368c83d66b31c596ae9.zip
rockbox-77a868360f9aac124a6cb368c83d66b31c596ae9.tar.gz
rockbox-77a868360f9aac124a6cb368c83d66b31c596ae9.tar.bz2
rockbox-77a868360f9aac124a6cb368c83d66b31c596ae9.tar.xz
make the moving smarter so you dont have to select the top card of a column to move the whole column
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13248 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/solitaire.c')
-rw-r--r--apps/plugins/solitaire.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c
index da6ca3c..a73e2c0 100644
--- a/apps/plugins/solitaire.c
+++ b/apps/plugins/solitaire.c
@@ -1448,7 +1448,24 @@ int solitaire( void )
else
{
/* try moving cards */
- move_card( cur_col, sel_card );
+ /* the code in the else seems to not like moveing kings
+ so if the selected card is a king do it the simple way */
+ if (deck[sel_card].num == CARDS_PER_SUIT - 1)
+ {
+ if (move_card( cur_col, sel_card ) == MOVE_NOT_OK)
+ sel_card = NOT_A_CARD;
+ }
+ else
+ {
+ int retval;
+ do {
+ retval = move_card( cur_col, sel_card );
+ if (retval == MOVE_NOT_OK)
+ {
+ sel_card = find_prev_card(sel_card);
+ }
+ } while ((retval == MOVE_NOT_OK) && (sel_card != NOT_A_CARD));
+ }
}
break;