diff -r e0a76ee1bb2b -r efeb98bc69c9 src/game.c --- a/src/game.c Tue Apr 01 14:04:00 2014 +0200 +++ b/src/game.c Thu Apr 03 16:07:04 2014 +0200 @@ -95,8 +95,7 @@ filechr(move.fromfile), rowchr(move.fromrow), move.capture ? 'x':'\0', filechr(move.tofile), rowchr(move.torow), - move.check ? '+' : (move.checkmate ? '#' : - (move.promotion ? '=' : '\0')), + move.check ? '+' : (move.promotion ? '=' : '\0'), move.promotion ? getpiecechr(move.promotion) : '\0' }; for (int stri = 0 ; stri < sizeof(logstr) ; stri++) { @@ -105,6 +104,13 @@ } } } + if (!logelem->next) { + if (gamestate->checkmate) { + addch('#'); + } else if (gamestate->stalemate) { + addstr(" stalemate"); + } + } addch(' '); logelem = logelem->next; @@ -162,11 +168,11 @@ case VALID_MOVE_SYNTAX: if (validate_move(gamestate, &move)) { apply_move(gamestate, &move); - if (move.checkmate) { + if (gamestate->checkmate) { printw("Checkmate!"); clrtoeol(); return 1; - } else if (move.stalemate) { + } else if (gamestate->stalemate) { printw("Stalemate!"); clrtoeol(); return 1; @@ -238,17 +244,17 @@ net_send_data(opponent, NETCODE_MOVE, &move, sizeof(Move)); code = net_recieve_code(opponent); move.check = code == NETCODE_CHECK; - move.checkmate = code == NETCODE_CHECKMATE; - move.stalemate = code == NETCODE_STALEMATE; + gamestate->checkmate = code == NETCODE_CHECKMATE; + gamestate->stalemate = code == NETCODE_STALEMATE; if (code == NETCODE_DECLINE) { printw("Invalid move."); } else { apply_move(gamestate, &move); - if (move.checkmate) { + if (gamestate->checkmate) { printw("Checkmate!"); clrtoeol(); return 1; - } else if (move.stalemate) { + } else if (gamestate->stalemate) { printw("Stalemate!"); clrtoeol(); return 1; @@ -300,12 +306,12 @@ apply_move(gamestate, &move); if (move.check) { net_send_code(opponent, NETCODE_CHECK); - } else if (move.checkmate) { + } else if (gamestate->checkmate) { net_send_code(opponent, NETCODE_CHECKMATE); printw("\rCheckmate!"); clrtoeol(); return 1; - } else if (move.stalemate) { + } else if (gamestate->stalemate) { net_send_code(opponent, NETCODE_STALEMATE); printw("\rStalemate!"); clrtoeol();