68 |
68 |
69 _Bool king_isblocked(GameState *gamestate, Move *move) { |
69 _Bool king_isblocked(GameState *gamestate, Move *move) { |
70 |
70 |
71 uint8_t opponent_color = opponent_color(move->piece&COLOR_MASK); |
71 uint8_t opponent_color = opponent_color(move->piece&COLOR_MASK); |
72 |
72 |
73 // being in check does not "block" the king, so don't test it here |
73 /* being in check does not "block" the king, so don't test it here */ |
74 _Bool blocked = 0; |
74 _Bool blocked = 0; |
75 |
75 |
76 // just test, if castling move is blocked |
76 /* just test, if castling move is blocked */ |
77 if (abs(move->tofile - move->fromfile) == 2) { |
77 if (abs(move->tofile - move->fromfile) == 2) { |
78 if (move->tofile == fileidx('c')) { |
78 if (move->tofile == fileidx('c')) { |
79 blocked |= gamestate->board[move->torow][fileidx('b')]; |
79 blocked |= gamestate->board[move->torow][fileidx('b')]; |
80 } |
80 } |
81 uint8_t midfile = (move->tofile+move->fromfile)/2; |
81 uint8_t midfile = (move->tofile+move->fromfile)/2; |