src/chess/rules.h

changeset 168
663676cfef6e
parent 167
fd1d3f0a7a73
equal deleted inserted replaced
167:fd1d3f0a7a73 168:663676cfef6e
289 289
290 /** 290 /**
291 * Determines a list of theoretically possible moves to the specified field. 291 * Determines a list of theoretically possible moves to the specified field.
292 * 292 *
293 * This will also list moves for pieces that are actually pinned. 293 * 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.
294 * 295 *
295 * The out-parameters may both be NULL, but if any of them is set, the other 296 * The out-parameters may both be NULL, but if any of them is set, the other
296 * must be set, too. 297 * must be set, too.
297 * 298 *
298 * @param gamestate the current game state 299 * @param gamestate the current game state
307 */ 308 */
308 bool get_candidates(const GameState *gamestate, Row row, File file, 309 bool get_candidates(const GameState *gamestate, Row row, File file,
309 Color color, Move* moves, size_t* movecount); 310 Color color, Move* moves, size_t* movecount);
310 311
311 /** 312 /**
313 * Determines a list of possible moves to the specified field.
314 *
315 * This cannot be used to check if a piece covers / threatens a field because
316 * this is also possible when the piece is pinned. Use get_candidates() for a
317 * list of possible moves regardless of pins.
318 *
319 * The out-parameters may both be NULL, but if any of them is set, the other
320 * must be set, too.
321 *
322 * @param gamestate the current game state
323 * @param row row of the field to check
324 * @param file file of the field to check
325 * @param color the color of the piece that should move to the field
326 * @param moves the array where to store the moves
327 * (must be large enough, 16 is always enough)
328 * @param movecount a pointer where the number of moves is stored
329 * @return true, if any piece of the specified color can move to the specified
330 * field and is not pinned
331 */
332 bool get_real_candidates(const GameState *gamestate, Row row, File file,
333 Color color, Move* moves, size_t* movecount);
334
335 /**
312 * Checks, if a specified field is threatened by a piece of a certain color. 336 * Checks, if a specified field is threatened by a piece of a certain color.
313 * 337 *
314 * A field is threatened, if there is a piece of the specified color that could 338 * A field is threatened, if there is a piece of the specified color that could
315 * capture an opponent piece on this field, regardless of being pinned. 339 * capture an opponent piece on this field, regardless of being pinned.
316 * 340 *

mercurial