| 1291 int exitcode = EXIT_SUCCESS; |
1291 int exitcode = EXIT_SUCCESS; |
| 1292 |
1292 |
| 1293 if (settings.continuepgn) { |
1293 if (settings.continuepgn) { |
| 1294 FILE *pgnfile = fopen(settings.continuepgn, "r"); |
1294 FILE *pgnfile = fopen(settings.continuepgn, "r"); |
| 1295 if (pgnfile) { |
1295 if (pgnfile) { |
| 1296 int result = read_pgn(pgnfile, &gamestate); |
1296 pgn_result result = read_pgn(pgnfile, &gamestate); |
| 1297 fclose(pgnfile); |
1297 fclose(pgnfile); |
| 1298 if (result) { |
1298 if (result.code) { |
| 1299 printw("Invalid PGN file content at position %zu:\n%s\n", |
1299 printw("Invalid PGN content at position %zu", result.position); |
| 1300 pgn_error_position(), pgn_error_str(result)); |
1300 if (result.move_half_number) { |
| |
1301 unsigned hm = result.move_half_number - 1; |
| |
1302 printw(" (move %u, %s)", 1+hm/2, hm%2 ? "black":"white"); |
| |
1303 } |
| |
1304 printw(":\n%s", pgn_error_str(result.code)); |
| |
1305 if (result.code == pgn_error_move) { |
| |
1306 addch(' '); |
| |
1307 eval_move_failed_msg(result.move_error); |
| |
1308 } |
| |
1309 printw("\n"); |
| 1301 exitcode = EXIT_FAILURE; |
1310 exitcode = EXIT_FAILURE; |
| 1302 } |
1311 } |
| 1303 /* clear resignation and remis flags to allow game continuation */ |
1312 /* clear resignation and remis flags to allow game continuation */ |
| 1304 gamestate.wresign = gamestate.bresign = gamestate.remis = false; |
1313 gamestate.wresign = gamestate.bresign = gamestate.remis = false; |
| 1305 } else { |
1314 } else { |