add check and checkmate to algebraic when missing
haldean
3 years ago
272 | 272 | size_t capture_index; /* only set if is_capture */ |
273 | 273 | size_t input_len; |
274 | 274 | size_t disambig_len; |
275 | char *tmp; | |
275 | 276 | struct move *result; |
276 | 277 | struct piece piece; |
277 | 278 | int i; |
479 | 480 | result->post_board->termination = VICTORY_WHITE; |
480 | 481 | else |
481 | 482 | result->post_board->termination = VICTORY_BLACK; |
483 | if (result->algebraic[input_len - 1] != '#') | |
484 | { | |
485 | tmp = result->algebraic; | |
486 | asprintf(&result->algebraic, "%s#", tmp); | |
487 | free(tmp); | |
488 | } | |
482 | 489 | } |
483 | 490 | else if (in_stalemate(result, opposite(result->player))) |
484 | 491 | { |
485 | 492 | result->post_board->termination = STALEMATE; |
493 | } | |
494 | else if (in_check(result, opposite(result->player))) | |
495 | { | |
496 | if (result->algebraic[input_len - 1] != '+') | |
497 | { | |
498 | tmp = result->algebraic; | |
499 | asprintf(&result->algebraic, "%s+", tmp); | |
500 | free(tmp); | |
501 | } | |
486 | 502 | } |
487 | 503 | result->post_board->draws = DRAW_NONE; |
488 | 504 |