--- a/src/chess/rules.h Wed Jul 29 13:45:51 2026 +0200 +++ b/src/chess/rules.h Thu Jul 30 11:49:47 2026 +0200 @@ -150,20 +150,6 @@ #define piece_color(piece) ((piece)&COLOR_MASK) #define mkpiece(type,color) ((type)|(color)) -#define enpassant_threat_add(gamestate, row, file) \ - (gamestate->board[row][file] |= ENPASSANT_THREAT) -#define enpassant_threat_remove(gamestate, row, file) \ - (gamestate->board[row][file] &= ~ENPASSANT_THREAT) -#define enpassant_threat_exists(gamestate, row, file) \ - (gamestate->board[row][file] & ENPASSANT_THREAT) - -#define is_game_running(gamestate) !((gamestate)->checkmate || \ - (gamestate)->wresign || (gamestate)->bresign || (gamestate)->threefold || \ - (gamestate)->stalemate || (gamestate)->remis || (gamestate)->review) - -#define last_move(gamestate) \ - ((gamestate)->moves[(gamestate)->movecount-1]) - #define POS_UNSPECIFIED UINT8_MAX #define mdst(m) (m)->torow, (m)->tofile #define msrc(m) (m)->fromrow, (m)->fromfile @@ -186,6 +172,26 @@ #define fileidx_s(c) (isfile(c)?fileidx(c):POS_UNSPECIFIED) #define rowidx_s(c) (isrow(c)?rowidx(c):POS_UNSPECIFIED) + +static inline void enpassant_threat_add(GameState *gamestate, + Row row, File file) { + gamestate->board[row][file] |= ENPASSANT_THREAT; +} + +static inline void enpassant_threat_remove(GameState *gamestate, + Row row, File file) { + gamestate->board[row][file] &= ~ENPASSANT_THREAT; +} + +static inline bool enpassant_threat_exists(const GameState *gamestate, + Row row, File file) { + return gamestate->board[row][file] & ENPASSANT_THREAT; +} + +static inline bool is_game_running(const GameState *gamestate) { + return !(gamestate->checkmate || gamestate->wresign || gamestate->bresign || gamestate->threefold || gamestate->stalemate || gamestate->remis || gamestate->review); +} + /** * Initializes a game state and prepares the chess board. * @param gamestate the game state to initialize