Rev 119 | Rev 150 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 119 | Rev 136 | ||
---|---|---|---|
Line 276... | Line 276... | ||
276 | char_index++; // figure out where the next word starts |
276 | char_index++; // figure out where the next word starts |
277 | 277 | ||
278 | continue; // and proceed to the next data |
278 | continue; // and proceed to the next data |
279 | } |
279 | } |
280 | 280 | ||
281 | // else is it a game |
281 | // else is it a game end marker ? |
282 | else if ((strncmp (&pgnfile_data[char_index], "1/2-1/2", 7) == 0) |
282 | else if ((strncmp (&pgnfile_data[char_index], "1/2-1/2", 7) == 0) |
283 | || (strncmp (&pgnfile_data[char_index], "1-0", 3) == 0) |
283 | || (strncmp (&pgnfile_data[char_index], "1-0", 3) == 0) |
284 | || (strncmp (&pgnfile_data[char_index], "0-1", 3) == 0) |
284 | || (strncmp (&pgnfile_data[char_index], "0-1", 3) == 0) |
285 | || (pgnfile_data[char_index] == '*')) |
285 | || (pgnfile_data[char_index] == '*')) |
286 | { |
286 | { |
Line 294... | Line 294... | ||
294 | new_move.source[1] = -1; |
294 | new_move.source[1] = -1; |
295 | new_move.target[0] = -1; |
295 | new_move.target[0] = -1; |
296 | new_move.target[1] = -1; |
296 | new_move.target[1] = -1; |
297 | new_move.promotion_type = 0; |
297 | new_move.promotion_type = 0; |
298 | pgn_comment[0] = 0; // reset comment |
298 | pgn_comment[0] = 0; // reset comment |
- | 299 | } |
|
- | 300 | ||
- | 301 | // has the game been closed ? |
|
- | 302 | if (strncmp (&pgnfile_data[char_index], "1/2-1/2", 7) == 0) |
|
- | 303 | board->game_state = STATE_DRAW_OTHER; // game closed on a draw (FIXME: identify variants) |
|
- | 304 | else if (strncmp (&pgnfile_data[char_index], "1-0", 7) == 0) |
|
- | 305 | { |
|
- | 306 | // see if it's a checkmate |
|
- | 307 | if (board->moves[board->move_count - 1].is_check && board->moves[board->move_count - 1].is_stalemate) |
|
- | 308 | board->game_state = STATE_WHITEWIN_CHECKMATE; // game was won by white on a checkmate (checkmate = check + stalemate) |
|
- | 309 | else |
|
- | 310 | board->game_state = STATE_WHITEWIN_RESIGNORFORFEIT; // game was won by white for another reason |
|
- | 311 | } |
|
- | 312 | else if (strncmp (&pgnfile_data[char_index], "0-1", 7) == 0) |
|
- | 313 | { |
|
- | 314 | // see if it's a checkmate |
|
- | 315 | if (board->moves[board->move_count - 1].is_check && board->moves[board->move_count - 1].is_stalemate) |
|
- | 316 | board->game_state = STATE_BLACKWIN_CHECKMATE; // game was won by black on a checkmate (checkmate = check + stalemate) |
|
- | 317 | else |
|
- | 318 | board->game_state = STATE_BLACKWIN_RESIGNORFORFEIT; // game was won by black for another reason |
|
299 | } |
319 | } |
300 | 320 | ||
301 | break; // we've finished reading the game |
321 | break; // we've finished reading the game |
302 | } |
322 | } |
303 | 323 |