src/chess/rules.h

changeset 169
9962f5d98764
parent 168
663676cfef6e
child 170
bde99d803caf
--- a/src/chess/rules.h	Sun Aug 02 15:19:47 2026 +0200
+++ b/src/chess/rules.h	Thu Aug 06 14:45:55 2026 +0200
@@ -287,6 +287,25 @@
     piece_set(gamestate, row, file, 0);
 }
 
+typedef size_t(*moves_generator_func)(GameState *gamestate,
+        Color c, Row r, File f, Move *moves);
+
+/**
+ * Internal function used to filter out illegal moves.
+ *
+ * Use the macros for the specific pieces instead.
+ *
+ * @param gamestate the current gamestate
+ * @param c color of the piece
+ * @param r the row of the piece
+ * @param f the file of the piece
+ * @param moves target array for the list of moves
+ * @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,
+    Color c, Row r, File f, Move *moves, moves_generator_func func);
+
 /**
  * Determines a list of theoretically possible moves to the specified field.
  *

mercurial