1.1 --- a/src/chess/bishop.c Mon Mar 31 14:08:00 2014 +0200 1.2 +++ b/src/chess/bishop.c Mon Mar 31 15:03:25 2014 +0200 1.3 @@ -35,7 +35,7 @@ 1.4 return abs(move->torow-move->fromrow) == abs(move->tofile-move->fromfile); 1.5 } 1.6 1.7 -_Bool bishop_isblocked(Board board, Move *move) { 1.8 +_Bool bishop_isblocked(GameState *gamestate, Move *move) { 1.9 int dy = move->torow > move->fromrow ? 1 : -1; 1.10 int dx = move->tofile > move->fromfile ? 1 : -1; 1.11 1.12 @@ -45,7 +45,7 @@ 1.13 while (x != move->tofile-dx && y != move->torow-dy) { 1.14 x += dx; 1.15 y += dy; 1.16 - if (board[y][x]) { 1.17 + if (gamestate->board[y][x]) { 1.18 return 1; 1.19 } 1.20 } 1.21 @@ -53,12 +53,12 @@ 1.22 return 0; 1.23 } 1.24 1.25 -static int bishop_getloc_fixedfile(Board board, Move *move) { 1.26 +static int bishop_getloc_fixedfile(GameState *gamestate, Move *move) { 1.27 uint8_t d = abs(move->fromfile - move->tofile); 1.28 - if (board[move->torow - d][move->fromfile] == move->piece) { 1.29 + if (gamestate->board[move->torow - d][move->fromfile] == move->piece) { 1.30 move->fromrow = move->torow - d; 1.31 } 1.32 - if (board[move->torow + d][move->fromfile] == move->piece) { 1.33 + if (gamestate->board[move->torow + d][move->fromfile] == move->piece) { 1.34 if (move->fromrow == POS_UNSPECIFIED) { 1.35 move->fromrow = move->torow + d; 1.36 } else { 1.37 @@ -69,12 +69,12 @@ 1.38 INVALID_POSITION : VALID_MOVE_SYNTAX; 1.39 } 1.40 1.41 -static int bishop_getloc_fixedrow(Board board, Move *move) { 1.42 +static int bishop_getloc_fixedrow(GameState *gamestate, Move *move) { 1.43 uint8_t d = abs(move->fromrow - move->torow); 1.44 - if (board[move->fromrow][move->tofile - d] == move->piece) { 1.45 + if (gamestate->board[move->fromrow][move->tofile - d] == move->piece) { 1.46 move->fromfile = move->tofile - d; 1.47 } 1.48 - if (board[move->fromrow][move->tofile + d] == move->piece) { 1.49 + if (gamestate->board[move->fromrow][move->tofile + d] == move->piece) { 1.50 if (move->fromfile == POS_UNSPECIFIED) { 1.51 move->fromfile = move->tofile + d; 1.52 } else { 1.53 @@ -85,14 +85,14 @@ 1.54 INVALID_POSITION : VALID_MOVE_SYNTAX; 1.55 } 1.56 1.57 -int bishop_getlocation(Board board, Move *move) { 1.58 +int bishop_getlocation(GameState *gamestate, Move *move) { 1.59 1.60 if (move->fromfile != POS_UNSPECIFIED) { 1.61 - return bishop_getloc_fixedfile(board, move); 1.62 + return bishop_getloc_fixedfile(gamestate, move); 1.63 } 1.64 1.65 if (move->fromrow != POS_UNSPECIFIED) { 1.66 - return bishop_getloc_fixedrow(board, move); 1.67 + return bishop_getloc_fixedrow(gamestate, move); 1.68 } 1.69 1.70 _Bool amb = 0; 1.71 @@ -100,7 +100,7 @@ 1.72 uint8_t row = move->torow + d; 1.73 if (isidx(row)) { 1.74 uint8_t file = move->tofile + d; 1.75 - if (isidx(file) && board[row][file] == move->piece) { 1.76 + if (isidx(file) && gamestate->board[row][file] == move->piece) { 1.77 if (amb) { 1.78 return AMBIGUOUS_MOVE; 1.79 } 1.80 @@ -109,7 +109,7 @@ 1.81 move->fromfile = file; 1.82 } 1.83 file = move->tofile - d; 1.84 - if (isidx(file) && board[row][file] == move->piece) { 1.85 + if (isidx(file) && gamestate->board[row][file] == move->piece) { 1.86 if (amb) { 1.87 return AMBIGUOUS_MOVE; 1.88 }