src/chess/bishop.c

changeset 21
2e5846019b4f
parent 19
6a26114297a1
child 23
824c9522ce66
     1.1 --- a/src/chess/bishop.c	Mon Mar 31 11:41:08 2014 +0200
     1.2 +++ b/src/chess/bishop.c	Mon Mar 31 14:00:58 2014 +0200
     1.3 @@ -42,13 +42,13 @@
     1.4      uint8_t y = move->fromrow;
     1.5      uint8_t x = move->fromfile;
     1.6      
     1.7 -    do {
     1.8 +    while (x != move->tofile-dx && y != move->torow-dy) {
     1.9          x += dx;
    1.10          y += dy;
    1.11          if (board[y][x]) {
    1.12              return 1;
    1.13          }
    1.14 -    } while (x != move->tofile && y != move->torow);
    1.15 +    }
    1.16      
    1.17      return 0;
    1.18  }

mercurial