src/chess/bishop.c

changeset 163
2a6d83f4677e
parent 80
b980a7192b5a
equal deleted inserted replaced
162:f0fc70b6f8f9 163:2a6d83f4677e
29 29
30 #include "bishop.h" 30 #include "bishop.h"
31 #include "rules.h" 31 #include "rules.h"
32 #include <stdlib.h> 32 #include <stdlib.h>
33 33
34 bool bishop_chkrules(Move* move) { 34 bool bishop_chkrules(const Move* move) {
35 return abs(move->torow-move->fromrow) == abs(move->tofile-move->fromfile); 35 return abs(move->torow-move->fromrow) == abs(move->tofile-move->fromfile);
36 } 36 }
37 37
38 bool bishop_isblocked(GameState *gamestate, Move *move) { 38 bool bishop_isblocked(const GameState *gamestate, const Move *move) {
39 int dy = move->torow > move->fromrow ? 1 : -1; 39 int dy = move->torow > move->fromrow ? 1 : -1;
40 int dx = move->tofile > move->fromfile ? 1 : -1; 40 int dx = move->tofile > move->fromfile ? 1 : -1;
41 41
42 uint8_t y = move->fromrow; 42 uint8_t y = move->fromrow;
43 uint8_t x = move->fromfile; 43 uint8_t x = move->fromfile;

mercurial