? apps/plugins/sudoku/.sudoku.c.swp
Index: apps/plugins/sudoku/sudoku.c
===================================================================
RCS file: /cvsroot/rockbox/apps/plugins/sudoku/sudoku.c,v
retrieving revision 1.9
diff -u -r1.9 sudoku.c
--- apps/plugins/sudoku/sudoku.c	4 Jun 2006 16:36:49 -0000	1.9
+++ apps/plugins/sudoku/sudoku.c	6 Aug 2006 14:51:07 -0000
@@ -562,10 +562,10 @@
 {
     int fd;
     size_t n;
-    int r = 0, c = 0;
+    int r = 0, c = 0, d = 0;
     unsigned int i;
     int valid=0;
-    char buf[300]; /* A buffer to read a sudoku board from */
+    char buf[500]; /* A buffer to read a sudoku board from */
 
     fd=rb->open(filename, O_RDONLY);
     if (fd < 0) {
@@ -574,15 +574,15 @@
     }
 
     rb->strncpy(state->filename,filename,MAX_PATH);
-    n=rb->read(fd,buf,300);
+    n=rb->read(fd,buf,500);
     if (n <= 0) {
         return(false);
     }
     rb->close(fd);
-
     r=0;
     c=0;
     i=0;
+    d=0;
     while ((i < n) && (r < 9)) {
         switch (buf[i]){
             case ' ': case '\t':
@@ -600,6 +600,7 @@
                     valid=0;
                 }
                 c = 0;
+                d = 0;
                 break;
             case '_': case '.':
                 valid=1;
@@ -627,6 +628,13 @@
                     }
                     c++;
                 }
+                if((buf[i]>='a' && buf[i] <= 'z') && i < (n-1)
+                    && (buf[i+1] >= 'a' && buf[i+1] <= 'z')) {
+                    state->possiblevals[r][d] 
+                        = (((buf[i]-'a') * 26 + buf[i+1]-'a')<<1);
+                    i+=2;
+                    d++;
+                }
                 /* Ignore any other characters */
                 break;
         }
@@ -645,6 +653,9 @@
     /* Save a copy of the saved state - so we can reload without using the
        disk */
     rb->memcpy(state->savedboard,state->currentboard,81);
+#ifdef SUDOKU_BUTTON_POSSIBLE
+    rb->memcpy(state->savedpossible, state->possiblevals, 81);
+#endif
     return(true);
 }
 
@@ -653,11 +664,20 @@
     int fd;
     int r,c;
     int i;
+    int x;
+#ifdef SUDOKU_BUTTON_POSSIBLE
+    char line[41];
+#else
     char line[13];
+#endif
     char sep[13];
 
     rb->splash(0, true, "Saving...");
+#ifdef SUDOKU_BUTTON_POSSIBLE
+    rb->memcpy(line,"...|...|... ;                          \r\n",41);
+#else
     rb->memcpy(line,"...|...|...\r\n",13);
+#endif
     rb->memcpy(sep,"-----------\r\n",13);
 
     if (state->filename[0]==0) {
@@ -681,6 +701,16 @@
                     i++;
                 }
             }
+#ifdef SUDOKU_BUTTON_POSSIBLE
+            i+=2;
+            for(c=0; c<9; c++) {
+                x = ((state->possiblevals[r][c]>>1)/26);
+                line[i++] = x + 'a';
+                x = ((state->possiblevals[r][c]>>1)%26);
+                line[i++] = x + 'a';
+                i++;
+            }
+#endif  
             rb->write(fd,line,sizeof(line));
             if ((r==2) || (r==5)) {
                 rb->write(fd,sep,sizeof(sep));
@@ -693,6 +723,9 @@
         /* Save a copy of the saved state - so we can reload without
            using the disk */
         rb->memcpy(state->savedboard,state->currentboard,81);
+#ifdef SUDOKU_BUTTON_POSSIBLE
+        rb->memcpy(state->savedpossible, state->possiblevals, 81);
+#endif
         return true;
     } else {
         return false;
@@ -702,6 +735,9 @@
 void restore_state(struct sudoku_state_t* state)
 {
     rb->memcpy(state->currentboard,state->savedboard,81);
+#ifdef SUDOKU_BUTTON_POSSIBLE
+    rb->memcpy(state->possiblevals, state->savedpossible, 81);
+#endif
 }
 
 void clear_board(struct sudoku_state_t* state)
Index: apps/plugins/sudoku/sudoku.h
===================================================================
RCS file: /cvsroot/rockbox/apps/plugins/sudoku/sudoku.h,v
retrieving revision 1.3
diff -u -r1.3 sudoku.h
--- apps/plugins/sudoku/sudoku.h	3 Aug 2006 20:17:24 -0000	1.3
+++ apps/plugins/sudoku/sudoku.h	6 Aug 2006 14:51:07 -0000
@@ -113,6 +113,7 @@
   int editmode;             /* We are editing the start board */
 #ifdef SUDOKU_BUTTON_POSSIBLE 
   short possiblevals[9][9];  /* possible values a cell could be, user sets them */
+  short savedpossible[9][9]; /* cached copy of possible cell values */
 #endif
 };
 
