src/main.c

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

mercurial