src/main.c

changeset 219
24b866230dd4
parent 212
16a114c84ff5
equal deleted inserted replaced
218:1e9751f8eb0d 219:24b866230dd4
351 351
352 for (unsigned mi = logi*2 ; mi < gamestate->movecount ; mi++) { 352 for (unsigned mi = logi*2 ; mi < gamestate->movecount ; mi++) {
353 bool iswhite = mi % 2 == 0; 353 bool iswhite = mi % 2 == 0;
354 if (iswhite) { 354 if (iswhite) {
355 logi++; 355 logi++;
356 printw("%d. ", logi); 356 printw("%d. ", logi); // TODO: add move_start offset
357 } 357 }
358 358
359 addstr(gamestate->moves[mi].string); 359 addstr(gamestate->moves[mi].string);
360 if (!iswhite && logi%3 == 0) { 360 if (!iswhite && logi%3 == 0) {
361 move(++logy, logx); 361 move(++logy, logx);
917 } else if (gamestate->threefold) { 917 } else if (gamestate->threefold) {
918 addstr("The game was drawn after threefold repetition.\n"); 918 addstr("The game was drawn after threefold repetition.\n");
919 } else if (gamestate->nomaterial) { 919 } else if (gamestate->nomaterial) {
920 addstr("The game is drawn due to insufficient material.\n"); 920 addstr("The game is drawn due to insufficient material.\n");
921 } else if (gamestate->checkmate) { 921 } else if (gamestate->checkmate) {
922 addstr(gamestate->movecount % 2 == 0 ? "White" : "Black"); 922 addstr(current_color(gamestate) == WHITE ? "White" : "Black");
923 addstr(" was checkmated.\n"); 923 addstr(" was checkmated.\n");
924 } else if (gamestate->ragequit) { 924 } else if (gamestate->ragequit) {
925 addstr("Your opponent disconnected.\n"); 925 addstr("Your opponent disconnected.\n");
926 } 926 }
927 addstr("\nPress 'q' to quit, 's' to save the position as PGN, or\n" 927 addstr("\nPress 'q' to quit, 's' to save the position as PGN, or\n"
1034 addstr(" No time limit\n"); 1034 addstr(" No time limit\n");
1035 } 1035 }
1036 addch('\n'); 1036 addch('\n');
1037 for (unsigned i = 0 ; i < gamestate->movecount ; i++) { 1037 for (unsigned i = 0 ; i < gamestate->movecount ; i++) {
1038 if (i % 2 == 0) { 1038 if (i % 2 == 0) {
1039 // TODO: add move_start offset
1039 printw("%d. %s", 1+i/2, gamestate->moves[i].string); 1040 printw("%d. %s", 1+i/2, gamestate->moves[i].string);
1040 } else { 1041 } else {
1041 printw("%s", gamestate->moves[i].string); 1042 printw("%s", gamestate->moves[i].string);
1042 } 1043 }
1043 // only five moves reliably fit into one screen rank 1044 // only five moves reliably fit into one screen rank

mercurial