src/game.c

changeset 68
b34de5ce7d0e
parent 63
611332453da0
child 69
c8f2c280cff7
equal deleted inserted replaced
67:c76e46970a59 68:b34de5ce7d0e
233 } else if (strncmp(movestr, "savepgn", MOVESTR_BUFLEN) == 0) { 233 } else if (strncmp(movestr, "savepgn", MOVESTR_BUFLEN) == 0) {
234 save_pgn(gamestate, gameinfo); 234 save_pgn(gamestate, gameinfo);
235 } else { 235 } else {
236 Move move; 236 Move move;
237 int result = eval_move(gamestate, movestr, &move, curcolor); 237 int result = eval_move(gamestate, movestr, &move, curcolor);
238 switch (result) { 238 if (result == VALID_MOVE_SYNTAX) {
239 case VALID_MOVE_SYNTAX:
240 result = validate_move(gamestate, &move); 239 result = validate_move(gamestate, &move);
241 if (result == VALID_MOVE_SEMANTICS) { 240 if (result == VALID_MOVE_SEMANTICS) {
242 apply_move(gamestate, &move); 241 apply_move(gamestate, &move);
243 if (gamestate->checkmate) { 242 if (gamestate->checkmate) {
244 printw("Checkmate!"); 243 printw("Checkmate!");
252 return 0; 251 return 0;
253 } 252 }
254 } else { 253 } else {
255 eval_move_failed_msg(result); 254 eval_move_failed_msg(result);
256 } 255 }
257 break; 256 } else {
258 default:
259 eval_move_failed_msg(result); 257 eval_move_failed_msg(result);
260 } 258 }
261 clrtoeol(); 259 clrtoeol();
262 } 260 }
263 } 261 }

mercurial