1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jens Arnold 2008-03-08 13:51:03 +00:00
parent 29d9ee40f3
commit 7fd70582f0

View file

@ -1625,23 +1625,19 @@ int solitaire( int skipmenu )
else else
{ {
/* try moving cards */ /* try moving cards */
/* the code in the else seems to not like moveing kings /* The flexible move must not be used from the remains stack. */
so if the selected card is a king do it the simple way */ if (find_card_col(sel_card) == REM_COL)
if (deck[sel_card].num == CARDS_PER_SUIT - 1)
{ {
if (move_card( cur_col, sel_card ) == MOVE_NOT_OK) if (move_card( cur_col, sel_card ) == MOVE_NOT_OK)
sel_card = NOT_A_CARD; sel_card = NOT_A_CARD;
} }
else else
{ {
int retval;
do { do {
retval = move_card( cur_col, sel_card ); if (move_card( cur_col, sel_card) == MOVE_OK)
if (retval == MOVE_NOT_OK) break;
{
sel_card = find_prev_card(sel_card); sel_card = find_prev_card(sel_card);
} } while (sel_card != NOT_A_CARD);
} while ((retval == MOVE_NOT_OK) && (sel_card != NOT_A_CARD));
} }
} }
break; break;