| 28 */ |
28 */ |
| 29 |
29 |
| 30 #include "rules.h" |
30 #include "rules.h" |
| 31 #include "rook.h" |
31 #include "rook.h" |
| 32 |
32 |
| 33 bool rook_chkrules(Move *move) { |
33 bool rook_chkrules(const Move *move) { |
| 34 return move->torow == move->fromrow || move->tofile == move->fromfile; |
34 return move->torow == move->fromrow || move->tofile == move->fromfile; |
| 35 } |
35 } |
| 36 |
36 |
| 37 bool rook_isblocked(GameState *gamestate, Move *move) { |
37 bool rook_isblocked(const GameState *gamestate, const Move *move) { |
| 38 |
38 |
| 39 if (move->torow == move->fromrow) { |
39 if (move->torow == move->fromrow) { |
| 40 int d = move->tofile > move->fromfile ? 1 : -1; |
40 int d = move->tofile > move->fromfile ? 1 : -1; |
| 41 uint8_t f = move->fromfile; |
41 uint8_t f = move->fromfile; |
| 42 while (f != move->tofile-d) { |
42 while (f != move->tofile-d) { |