diff options
| author | Jens Arnold <amiconn@rockbox.org> | 2008-03-08 13:51:03 +0000 |
|---|---|---|
| committer | Jens Arnold <amiconn@rockbox.org> | 2008-03-08 13:51:03 +0000 |
| commit | 7fd70582f02fce63fea336d0bab80598d218fa7e (patch) | |
| tree | e66a18ad218b671710329fd084cafb38aec3d387 /apps/plugins | |
| parent | 29d9ee40f31e7e1e0a530f5a1461978b8867397f (diff) | |
| download | rockbox-7fd70582f02fce63fea336d0bab80598d218fa7e.zip rockbox-7fd70582f02fce63fea336d0bab80598d218fa7e.tar.gz rockbox-7fd70582f02fce63fea336d0bab80598d218fa7e.tar.bz2 rockbox-7fd70582f02fce63fea336d0bab80598d218fa7e.tar.xz | |
Fix FS #7955. Smart move must not be used on the remains stack. * Remove the special case for moving kings as is no longer necessary, and write the smart move in a slightly more elegant way.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16555 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
| -rw-r--r-- | apps/plugins/solitaire.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c index 95d76f6..fba2bf5 100644 --- a/apps/plugins/solitaire.c +++ b/apps/plugins/solitaire.c @@ -1625,23 +1625,19 @@ int solitaire( int skipmenu ) else { /* try moving cards */ - /* 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) + /* The flexible move must not be used from the remains stack. */ + if (find_card_col(sel_card) == REM_COL) { 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)); + if (move_card( cur_col, sel_card) == MOVE_OK) + break; + sel_card = find_prev_card(sel_card); + } while (sel_card != NOT_A_CARD); } } break; |