src/chess/rules.h

changeset 170
bde99d803caf
parent 169
9962f5d98764
--- a/src/chess/rules.h	Thu Aug 06 14:45:55 2026 +0200
+++ b/src/chess/rules.h	Thu Aug 06 16:11:37 2026 +0200
@@ -287,10 +287,24 @@
     piece_set(gamestate, row, file, 0);
 }
 
-typedef size_t(*moves_generator_func)(GameState *gamestate,
+typedef size_t(*moves_generator_func)(const GameState *gamestate,
         Color c, Row r, File f, Move *moves);
 
 /**
+ * Calculates all allowed moves for a specific piece.
+ *
+ * Use the macros for the specific pieces instead.
+ *
+ * @param gamestate the current gamestate
+ * @param r the row of the piece
+ * @param f the file of the piece
+ * @param moves target array for the list of moves
+ * @return the number of moves stored in the @p moves array
+ */
+size_t piece_moves_allowed(const GameState *gamestate,
+        Row r, File f, Move *moves);
+
+/**
  * Internal function used to filter out illegal moves.
  *
  * Use the macros for the specific pieces instead.
@@ -303,7 +317,7 @@
  * @param func a function that unconditionally generates the moves
  * @return the number of moves stored in the @p moves array
  */
-size_t filter_moves_allowed(GameState *gamestate,
+size_t filter_moves_allowed(const GameState *gamestate,
     Color c, Row r, File f, Move *moves, moves_generator_func func);
 
 /**

mercurial