src/game.c

changeset 91
c7b586c0ee36
parent 90
395542d915d7
equal deleted inserted replaced
90:395542d915d7 91:c7b586c0ee36
212 size_t bufpos = 0; 212 size_t bufpos = 0;
213 char movestr[MOVESTR_BUFLEN]; 213 char movestr[MOVESTR_BUFLEN];
214 214
215 flushinp(); 215 flushinp();
216 while (1) { 216 while (1) {
217 const char *curcolorstr = curcolor == WHITE ? "White" : "Black";
217 if (timecontrol(gamestate, gameinfo)) { 218 if (timecontrol(gamestate, gameinfo)) {
218 return 1; 219 return 1;
219 } 220 }
220
221 move(inputy, 0); 221 move(inputy, 0);
222 printw( 222 printw(
223 "Use chess notation to enter your move.\n" 223 "Use chess notation to enter your move.\n"
224 "Or use a command: remis, resign, savepgn\n\n" 224 "Or use a command: remis, resign, savepgn\n\n"
225 "Type your move: "); 225 "%s to move: ", curcolorstr);
226 clrtoeol(); 226 clrtoeol();
227 227
228 if (asyncgetnstr(movestr, &bufpos, MOVESTR_BUFLEN)) { 228 if (asyncgetnstr(movestr, &bufpos, MOVESTR_BUFLEN)) {
229 if (strncmp(movestr, "resign", MOVESTR_BUFLEN) == 0) { 229 if (strncmp(movestr, "resign", MOVESTR_BUFLEN) == 0) {
230 gamestate->resign = 1; 230 gamestate->resign = 1;
231 printw("%s resigned!", 231 printw("%s resigned!", curcolorstr);
232 curcolor==WHITE?"White":"Black");
233 clrtobot(); 232 clrtobot();
234 refresh(); 233 refresh();
235 return 1; 234 return 1;
236 } else if (strncmp(movestr, "remis", MOVESTR_BUFLEN) == 0) { 235 } else if (strncmp(movestr, "remis", MOVESTR_BUFLEN) == 0) {
237 gamestate->remis = 1; 236 gamestate->remis = 1;

mercurial