From 7fd70582f02fce63fea336d0bab80598d218fa7e Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sat, 8 Mar 2008 13:51:03 +0000 Subject: 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 --- apps/plugins/solitaire.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'apps/plugins') 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; -- cgit v1.1