src/game.c

changeset 44
1891d88cbd10
parent 43
12141136a0da
child 45
e14a1d9aa91d
equal deleted inserted replaced
43:12141136a0da 44:1891d88cbd10
186 } 186 }
187 187
188 move(inputy, 0); 188 move(inputy, 0);
189 printw( 189 printw(
190 "Use chess notation to enter your move.\n" 190 "Use chess notation to enter your move.\n"
191 "Or type 'surr' to surrender or 'remis' to end with remis.\n\n" 191 "Or type 'resign' to resign or 'remis' to end with remis.\n\n"
192 "Type your move: "); 192 "Type your move: ");
193 clrtoeol(); 193 clrtoeol();
194 194
195 if (asyncgetnstr(movestr, &bufpos, MOVESTR_BUFLEN)) { 195 if (asyncgetnstr(movestr, &bufpos, MOVESTR_BUFLEN)) {
196 if (strncmp(movestr, "surr", MOVESTR_BUFLEN) == 0) { 196 if (strncmp(movestr, "resign", MOVESTR_BUFLEN) == 0) {
197 printw("%s surrendered!", 197 printw("%s resigned!",
198 gamestate->mycolor==WHITE?"White":"Black"); 198 gamestate->mycolor==WHITE?"White":"Black");
199 clrtoeol(); 199 clrtoeol();
200 refresh(); 200 refresh();
201 return 1; 201 return 1;
202 } else if (strncmp(movestr, "remis", MOVESTR_BUFLEN) == 0) { 202 } else if (strncmp(movestr, "remis", MOVESTR_BUFLEN) == 0) {
251 251
252 move(inputy, 0); 252 move(inputy, 0);
253 if (remisrejected) { 253 if (remisrejected) {
254 printw( 254 printw(
255 "Use chess notation to enter your move.\n" 255 "Use chess notation to enter your move.\n"
256 "Remis offer rejected - type 'surr' to surrender. \n\n" 256 "Remis offer rejected - type 'resign' to resign. \n\n"
257 "Type your move: "); 257 "Type your move: ");
258 } else { 258 } else {
259 printw( 259 printw(
260 "Use chess notation to enter your move.\n" 260 "Use chess notation to enter your move.\n"
261 "Or type 'surr' to surrender or 'remis' to offer remis.\n\n" 261 "Or type 'resign' to resign or 'remis' to offer remis.\n\n"
262 "Type your move: "); 262 "Type your move: ");
263 } 263 }
264 clrtoeol(); 264 clrtoeol();
265 265
266 if (asyncgetnstr(movestr, &bufpos, MOVESTR_BUFLEN)) { 266 if (asyncgetnstr(movestr, &bufpos, MOVESTR_BUFLEN)) {
267 if (strncmp(movestr, "surr", MOVESTR_BUFLEN) == 0) { 267 if (strncmp(movestr, "resign", MOVESTR_BUFLEN) == 0) {
268 printw("You surrendered!"); 268 printw("You resigned!");
269 clrtoeol(); 269 clrtoeol();
270 refresh(); 270 refresh();
271 net_send_code(opponent, NETCODE_SURRENDER); 271 net_send_code(opponent, NETCODE_RESIGN);
272 return 1; 272 return 1;
273 } else if (strncmp(movestr, "remis", MOVESTR_BUFLEN) == 0) { 273 } else if (strncmp(movestr, "remis", MOVESTR_BUFLEN) == 0) {
274 if (!remisrejected) { 274 if (!remisrejected) {
275 net_send_code(opponent, NETCODE_REMIS); 275 net_send_code(opponent, NETCODE_REMIS);
276 printw("Remis offer sent - waiting for acceptance..."); 276 printw("Remis offer sent - waiting for acceptance...");
362 switch (code) { 362 switch (code) {
363 case NETCODE_TIMEOVER: 363 case NETCODE_TIMEOVER:
364 printw("\rYour opponent's time ran out - you win!"); 364 printw("\rYour opponent's time ran out - you win!");
365 clrtoeol(); 365 clrtoeol();
366 return 1; 366 return 1;
367 case NETCODE_SURRENDER: 367 case NETCODE_RESIGN:
368 printw("\rYour opponent surrendered!"); 368 printw("\rYour opponent resigned!");
369 clrtoeol(); 369 clrtoeol();
370 return 1; 370 return 1;
371 case NETCODE_REMIS: 371 case NETCODE_REMIS:
372 if (prompt_yesno( 372 if (prompt_yesno(
373 "\rYour opponent offers remis - do you accept")) { 373 "\rYour opponent offers remis - do you accept")) {

mercurial