src/chess/rules.c

changeset 51
84f2e380a434
parent 50
41017d0a72c5
child 55
54ea19938d57
     1.1 --- a/src/chess/rules.c	Mon Jun 16 13:45:31 2014 +0200
     1.2 +++ b/src/chess/rules.c	Mon Jun 16 15:41:06 2014 +0200
     1.3 @@ -40,7 +40,7 @@
     1.4          *lastmovecopy = *(simulation.lastmove);
     1.5          simulation.movelist = simulation.lastmove = lastmovecopy;
     1.6      }
     1.7 -        
     1.8 +
     1.9      return simulation;
    1.10  }
    1.11  
    1.12 @@ -421,13 +421,13 @@
    1.13                      }
    1.14                  } else {
    1.15                      /* bishop aspect */
    1.16 -                    int dr = move->torow > move->fromrow ? 1 : -1;
    1.17 -                    int df = move->tofile > move->fromfile ? 1 : -1;
    1.18 +                    int dr = threat->torow > threat->fromrow ? 1 : -1;
    1.19 +                    int df = threat->tofile > threat->fromfile ? 1 : -1;
    1.20  
    1.21 -                    uint8_t row = move->fromrow;
    1.22 -                    uint8_t file = move->fromfile;
    1.23 -                    while (!canescape && file != move->tofile - df
    1.24 -                        && row != move->torow - dr) {
    1.25 +                    uint8_t row = threat->fromrow;
    1.26 +                    uint8_t file = threat->fromfile;
    1.27 +                    while (!canescape && file != threat->tofile - df
    1.28 +                        && row != threat->torow - dr) {
    1.29                          row += dr;
    1.30                          file += df;
    1.31                          canescape |= is_protected(&simulation, row, file,

mercurial