src/main.c

changeset 202
6960625e62e0
parent 199
3d4d361ebb80
equal deleted inserted replaced
201:b61c2b90f19c 202:6960625e62e0
402 printw("Unknown move parser error."); 402 printw("Unknown move parser error.");
403 } 403 }
404 } 404 }
405 405
406 static void save_pgn(GameState *gamestate) { 406 static void save_pgn(GameState *gamestate) {
407 int y = getcury(stdscr); 407 int y;
408 {
409 int x;
410 getyx(stdscr, y, x);
411 (void)x; /* we want to be POSIX curses compliant */
412 }
408 413
409 /* ask for player names */ 414 /* ask for player names */
410 { 415 {
411 char pname[PLAYER_NAME_BUFLEN]; 416 char pname[PLAYER_NAME_BUFLEN];
412 printw("\rWhite's name (%s): ", pgn_player_name(gamestate, WHITE)); 417 printw("\rWhite's name (%s): ", pgn_player_name(gamestate, WHITE));
893 898
894 erase(); /* don't use clear() to avoid flickering */ 899 erase(); /* don't use clear() to avoid flickering */
895 draw_board(&viewedstate, WHITE); 900 draw_board(&viewedstate, WHITE);
896 timecontrol(&viewedstate); 901 timecontrol(&viewedstate);
897 902
898 move(getmaxy(stdscr)-5, 0); 903 move(input_getmaxy()-5, 0);
899 if (gamestate->wresign) { 904 if (gamestate->wresign) {
900 addstr("White resigned.\n"); 905 addstr("White resigned.\n");
901 } else if (gamestate->bresign) { 906 } else if (gamestate->bresign) {
902 addstr("Black resigned.\n"); 907 addstr("Black resigned.\n");
903 } else if (gamestate->remis) { 908 } else if (gamestate->remis) {
960 echo(); 965 echo();
961 gamestate_cleanup(&viewedstate); 966 gamestate_cleanup(&viewedstate);
962 } 967 }
963 968
964 static void game_play_singlemachine(GameState *gamestate) { 969 static void game_play_singlemachine(GameState *gamestate) {
965 inputy = getmaxy(stdscr) - 6; 970 inputy = input_getmaxy() - 6;
966 971
967 Color curcol = current_color(gamestate); 972 Color curcol = current_color(gamestate);
968 bool running = is_game_running(gamestate); 973 bool running = is_game_running(gamestate);
969 while (running) { 974 while (running) {
970 clear(); 975 clear();
975 } 980 }
976 game_review(gamestate); 981 game_review(gamestate);
977 } 982 }
978 983
979 static void game_play(GameState *gamestate, int opponent, bool as_client) { 984 static void game_play(GameState *gamestate, int opponent, bool as_client) {
980 inputy = getmaxy(stdscr) - 6; 985 inputy = input_getmaxy() - 6;
981 986
982 Color mycolor = gamestate->info.servercolor; 987 Color mycolor = gamestate->info.servercolor;
983 if (as_client) { 988 if (as_client) {
984 mycolor = opponent_color(mycolor); 989 mycolor = opponent_color(mycolor);
985 } 990 }
1308 } 1313 }
1309 } 1314 }
1310 1315
1311 gamestate_cleanup(&gamestate); 1316 gamestate_cleanup(&gamestate);
1312 1317
1313 mvaddstr(getmaxy(stdscr)-1, 0, 1318 mvaddstr(input_getmaxy()-1, 0,
1314 "Game has ended. Press any key to leave..."); 1319 "Game has ended. Press any key to leave...");
1315 clrtoeol(); 1320 clrtoeol();
1316 refresh(); 1321 refresh();
1317 cbreak(); 1322 cbreak();
1318 flushinp(); 1323 flushinp();

mercurial