summaryrefslogtreecommitdiff
path: root/apps/plugins/solitaire.c
diff options
context:
space:
mode:
authorAntoine Cellerier <dionoea@videolan.org>2006-09-02 21:56:22 +0000
committerAntoine Cellerier <dionoea@videolan.org>2006-09-02 21:56:22 +0000
commitce9fe07d51b9e3ff1625314a58111794dd351729 (patch)
tree32949b36c2fd9a8a87328216cada82ce4027aeac /apps/plugins/solitaire.c
parent30461369def481c2eb53d36f63644eaff7de4a1d (diff)
downloadrockbox-ce9fe07d51b9e3ff1625314a58111794dd351729.tar.gz
rockbox-ce9fe07d51b9e3ff1625314a58111794dd351729.zip
Hopefully fix solitaire invisible card bug ... and add some more.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10859 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/solitaire.c')
-rw-r--r--apps/plugins/solitaire.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c
index 1e4f7fd1dd..0f0f56e14a 100644
--- a/apps/plugins/solitaire.c
+++ b/apps/plugins/solitaire.c
@@ -738,7 +738,7 @@ card_t deck[ NUM_CARDS ];
738/* the remaining cards */ 738/* the remaining cards */
739unsigned char rem; 739unsigned char rem;
740unsigned char cur_rem; 740unsigned char cur_rem;
741unsigned char coun_rem; 741unsigned char count_rem;
742 742
743/* the 7 game columns */ 743/* the 7 game columns */
744unsigned char cols[COL_NUM]; 744unsigned char cols[COL_NUM];
@@ -852,7 +852,7 @@ void solitaire_init( void )
852 /* init the remainder */ 852 /* init the remainder */
853 cur_rem = NOT_A_CARD; 853 cur_rem = NOT_A_CARD;
854 854
855 coun_rem=0; 855 count_rem=0;
856} 856}
857 857
858/* find the column number in which 'card' can be found */ 858/* find the column number in which 'card' can be found */
@@ -1025,7 +1025,7 @@ enum move move_card( unsigned char dest_col, unsigned char src_card )
1025 if( src_card_prev == NOT_A_CARD ) 1025 if( src_card_prev == NOT_A_CARD )
1026 { 1026 {
1027 rem = deck[src_card].next; 1027 rem = deck[src_card].next;
1028 coun_rem = coun_rem-1; 1028 count_rem = count_rem-1;
1029 } 1029 }
1030 /* if src card is not the first card from the stack */ 1030 /* if src card is not the first card from the stack */
1031 else 1031 else
@@ -1034,7 +1034,7 @@ enum move move_card( unsigned char dest_col, unsigned char src_card )
1034 } 1034 }
1035 deck[src_card].next = NOT_A_CARD; 1035 deck[src_card].next = NOT_A_CARD;
1036 cur_rem = src_card_prev; 1036 cur_rem = src_card_prev;
1037 coun_rem = coun_rem-1; 1037 count_rem = count_rem-1;
1038 } 1038 }
1039 /* if the src card is from somewhere else, just take everything */ 1039 /* if the src card is from somewhere else, just take everything */
1040 else 1040 else
@@ -1201,10 +1201,9 @@ int solitaire( void )
1201 1201
1202 if( rem != NOT_A_CARD ) 1202 if( rem != NOT_A_CARD )
1203 { 1203 {
1204 if( coun_rem >= cards_per_draw ) 1204 if( count_rem >= cards_per_draw )
1205 coun_rem = cards_per_draw-1; 1205 count_rem = cards_per_draw-1;
1206 if( cur_rem != NOT_A_CARD 1206 if( cur_rem != NOT_A_CARD )
1207 && find_prev_card(cur_rem) != NOT_A_CARD )
1208 { 1207 {
1209 prevcard = cur_rem; 1208 prevcard = cur_rem;
1210#if UPPER_ROW_MARGIN > 0 1209#if UPPER_ROW_MARGIN > 0
@@ -1212,13 +1211,13 @@ int solitaire( void )
1212#else 1211#else
1213 j = CARD_WIDTH/2+2*UPPER_ROW_MARGIN+1; 1212 j = CARD_WIDTH/2+2*UPPER_ROW_MARGIN+1;
1214#endif 1213#endif
1215 for( i = 0; i < coun_rem; i++ ) 1214 for( i = 0; i < count_rem; i++ )
1216 prevcard = find_prev_card(prevcard); 1215 prevcard = find_prev_card(prevcard);
1217 for( i = 0; i <= coun_rem; i++ ) 1216 for( i = 0; i <= count_rem; i++ )
1218 { 1217 {
1219 draw_card( deck[prevcard], j, 1218 draw_card( deck[prevcard], j,
1220 UPPER_ROW_MARGIN, sel_card == prevcard, 1219 UPPER_ROW_MARGIN, sel_card == prevcard,
1221 cur_card == prevcard, i < coun_rem ); 1220 cur_card == prevcard, i < count_rem );
1222 prevcard = deck[prevcard].next; 1221 prevcard = deck[prevcard].next;
1223 j += NUMBER_WIDTH+2; 1222 j += NUMBER_WIDTH+2;
1224 } 1223 }
@@ -1426,7 +1425,7 @@ int solitaire( void )
1426 if( lastbutton != SOL_REM2CUR_PRE ) 1425 if( lastbutton != SOL_REM2CUR_PRE )
1427 break; 1426 break;
1428#endif 1427#endif
1429 coun_rem = coun_rem-1; 1428 count_rem = count_rem-1;
1430 move_card( cur_col, cur_rem ); 1429 move_card( cur_col, cur_rem );
1431 sel_card = NOT_A_CARD; 1430 sel_card = NOT_A_CARD;
1432 break; 1431 break;
@@ -1442,7 +1441,7 @@ int solitaire( void )
1442 { 1441 {
1443 move_card( deck[cur_rem].suit + COL_NUM, cur_rem ); 1442 move_card( deck[cur_rem].suit + COL_NUM, cur_rem );
1444 sel_card = NOT_A_CARD; 1443 sel_card = NOT_A_CARD;
1445 coun_rem = coun_rem-1; 1444 count_rem = count_rem-1;
1446 } 1445 }
1447 break; 1446 break;
1448 1447
@@ -1456,7 +1455,7 @@ int solitaire( void )
1456 } 1455 }
1457 if( rem != NOT_A_CARD && cur_rem != NOT_A_CARD ) 1456 if( rem != NOT_A_CARD && cur_rem != NOT_A_CARD )
1458 { 1457 {
1459 sel_card=cur_rem; 1458 sel_card = cur_rem;
1460 break; 1459 break;
1461 } 1460 }
1462 break; 1461 break;
@@ -1478,13 +1477,14 @@ int solitaire( void )
1478 if( rem != NOT_A_CARD ) 1477 if( rem != NOT_A_CARD )
1479 { 1478 {
1480 int cur_rem_old = cur_rem; 1479 int cur_rem_old = cur_rem;
1481 coun_rem = 0; 1480 count_rem = 0;
1482 /* draw new cards form the remains of the deck */ 1481 /* draw new cards form the remains of the deck */
1483 if( cur_rem == NOT_A_CARD ) 1482 if( cur_rem == NOT_A_CARD )
1484 { 1483 {
1485 /*if the cursor card is null*/ 1484 /*if the cursor card is null*/
1486 cur_rem = rem; 1485 cur_rem = rem;
1487 i = cards_per_draw - 1; 1486 i = cards_per_draw - 1;
1487 count_rem++;
1488 } 1488 }
1489 else 1489 else
1490 { 1490 {
@@ -1495,14 +1495,14 @@ int solitaire( void )
1495 { 1495 {
1496 cur_rem = deck[cur_rem].next; 1496 cur_rem = deck[cur_rem].next;
1497 i--; 1497 i--;
1498 coun_rem = coun_rem +1; 1498 count_rem++;
1499 } 1499 }
1500 /* test if any cards are really left on 1500 /* test if any cards are really left on
1501 * the remains' stack */ 1501 * the remains' stack */
1502 if( i == cards_per_draw ) 1502 if( i > 0 )
1503 { 1503 {
1504 cur_rem = NOT_A_CARD; 1504 cur_rem = NOT_A_CARD;
1505 coun_rem = 0; 1505 count_rem = 0;
1506 } 1506 }
1507 /* if cursor was on remains' stack when new cards were 1507 /* if cursor was on remains' stack when new cards were
1508 * drawn, put cursor on top of remains' stack */ 1508 * drawn, put cursor on top of remains' stack */