Package: xsol / 0.31-14

40-fix-undo.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Description: Fix undo.
             After undo-ing, the 'prev' pointer of the card that has been exposed
             by the undo needs to be set to NULL.
             The code to do this existed, but was being called before the undo.
             This patch relocates this line of code to after the undo.
Author: Graham Inggs <graham@nerve.org.za>
Last-Update: 2013-06-23
--- a/xsol.c
+++ b/xsol.c
@@ -403,7 +403,6 @@
    }                  
    temp = piles[temp_undo->topile];
    for(i=0; i<undo->numcards-1; i++) temp = temp->next;
-   if(piles[temp_undo->topile] != NULL) piles[temp_undo->topile]->prev = NULL;
    if(piles[temp_undo->frompile] != NULL) piles[temp_undo->frompile]->prev = temp;
    piles[temp_undo->topile] = temp->next;
    for(i=0; i<undo->numcards; i++) {
@@ -419,6 +418,7 @@
       if(temp_undo->frompile == 7) numcards++;
       else if(temp_undo->topile == 7) numcards--;
    }
+   if(piles[temp_undo->topile] != NULL) piles[temp_undo->topile]->prev = NULL;
    if(temp_undo->score != 0) UpScore(temp_undo->score * -1);
    undo = undo->next;
    free(temp_undo);