src/chess/rook.c

changeset 163
2a6d83f4677e
parent 80
b980a7192b5a
equal deleted inserted replaced
162:f0fc70b6f8f9 163:2a6d83f4677e
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) {

mercurial