1.1 --- a/src/chess/rules.h Tue Apr 01 10:28:08 2014 +0200 1.2 +++ b/src/chess/rules.h Tue Apr 01 12:30:25 2014 +0200 1.3 @@ -95,6 +95,8 @@ 1.4 MoveList* lastmove; 1.5 } GameState; 1.6 1.7 +#define opponent_color(color) ((color)==WHITE?BLACK:WHITE) 1.8 + 1.9 #define POS_UNSPECIFIED UINT8_MAX 1.10 #define mdst(b,m) b[(m)->torow][(m)->tofile] 1.11 #define msrc(b,m) b[(m)->fromrow][(m)->fromfile] 1.12 @@ -140,6 +142,18 @@ 1.13 char getpiecechr(uint8_t piece); 1.14 1.15 /** 1.16 + * Checks, if a specified field is covered by a piece of a certain color. 1.17 + * 1.18 + * @param gamestate the current game state 1.19 + * @param row row of the field to check 1.20 + * @param file file of the field to check 1.21 + * @param color the color of the piece that should cover the field 1.22 + * @return TRUE, if any piece of the specified color threatens the specified 1.23 + * field (i.e. could capture an opponent piece) 1.24 + */ 1.25 +_Bool is_covered(GameState *gamestate,uint8_t row,uint8_t file,uint8_t color); 1.26 + 1.27 +/** 1.28 * Evaluates a move syntactically and stores the move data in the specified 1.29 * object. 1.30 *