| 45 |
44 |
| 46 static int timecontrol(GameState *gamestate, GameInfo *gameinfo) { |
45 static int timecontrol(GameState *gamestate, GameInfo *gameinfo) { |
| 47 if (gameinfo->timecontrol) { |
46 if (gameinfo->timecontrol) { |
| 48 uint16_t white = remaining_movetime(gameinfo, gamestate, WHITE); |
47 uint16_t white = remaining_movetime(gameinfo, gamestate, WHITE); |
| 49 uint16_t black = remaining_movetime(gameinfo, gamestate, BLACK); |
48 uint16_t black = remaining_movetime(gameinfo, gamestate, BLACK); |
| 50 mvprintw(boardy+4, boardx-1, |
49 char clkstr[16]; |
| 51 "White time: %4" PRIu16 ":%02" PRIu16, |
50 bool always_hours = gameinfo->time >= 3600; |
| 52 white / 60, white % 60); |
51 print_clk(white, clkstr, always_hours); |
| 53 mvprintw(boardy+5, boardx-1, |
52 mvprintw(boardy+4, boardx-1, "White time: %s", clkstr); |
| 54 "Black time: %4" PRIu16 ":%02" PRIu16, |
53 print_clk(black, clkstr, always_hours); |
| 55 black / 60, black % 60); |
54 mvprintw(boardy+5, boardx-1, "Black time: %s", clkstr); |
| 56 |
55 |
| 57 if (white == 0) { |
56 if (white == 0) { |
| 58 move(inputy, 0); |
57 move(inputy, 0); |
| 59 printw("Time is over - Black wins!"); |
58 printw("Time is over - Black wins!"); |
| 60 clrtobot(); |
59 clrtobot(); |