| 285 */ |
285 */ |
| 286 static inline void piece_remove(GameState *gamestate, Row row, File file) { |
286 static inline void piece_remove(GameState *gamestate, Row row, File file) { |
| 287 piece_set(gamestate, row, file, 0); |
287 piece_set(gamestate, row, file, 0); |
| 288 } |
288 } |
| 289 |
289 |
| |
290 typedef size_t(*moves_generator_func)(GameState *gamestate, |
| |
291 Color c, Row r, File f, Move *moves); |
| |
292 |
| |
293 /** |
| |
294 * Internal function used to filter out illegal moves. |
| |
295 * |
| |
296 * Use the macros for the specific pieces instead. |
| |
297 * |
| |
298 * @param gamestate the current gamestate |
| |
299 * @param c color of the piece |
| |
300 * @param r the row of the piece |
| |
301 * @param f the file of the piece |
| |
302 * @param moves target array for the list of moves |
| |
303 * @param func a function that unconditionally generates the moves |
| |
304 * @return the number of moves stored in the @p moves array |
| |
305 */ |
| |
306 size_t filter_moves_allowed(GameState *gamestate, |
| |
307 Color c, Row r, File f, Move *moves, moves_generator_func func); |
| |
308 |
| 290 /** |
309 /** |
| 291 * Determines a list of theoretically possible moves to the specified field. |
310 * Determines a list of theoretically possible moves to the specified field. |
| 292 * |
311 * |
| 293 * This will also list moves for pieces that are actually pinned. |
312 * This will also list moves for pieces that are actually pinned. |
| 294 * Use get_real_candidates() to get only moves for pieces that are not pinned. |
313 * Use get_real_candidates() to get only moves for pieces that are not pinned. |