Wed, 16 Apr 2014 21:57:53 +0200
fixed bug where an invalid network response lead to an accepted move
src/game.c | file | annotate | diff | comparison | revisions |
1.1 --- a/src/game.c Wed Apr 16 21:46:34 2014 +0200 1.2 +++ b/src/game.c Wed Apr 16 21:57:53 2014 +0200 1.3 @@ -296,7 +296,10 @@ 1.4 gamestate->stalemate = code == NETCODE_STALEMATE; 1.5 if (code == NETCODE_DECLINE) { 1.6 printw("Invalid move."); 1.7 - } else { 1.8 + } else if (code == NETCODE_ACCEPT 1.9 + || code == NETCODE_CHECK 1.10 + || code == NETCODE_CHECKMATE 1.11 + || code == NETCODE_STALEMATE) { 1.12 apply_move(gamestate, &move); 1.13 if (gamestate->checkmate) { 1.14 printw("Checkmate!"); 1.15 @@ -309,6 +312,8 @@ 1.16 } else { 1.17 return 0; 1.18 } 1.19 + } else { 1.20 + printw("Invalid network response."); 1.21 } 1.22 break; 1.23 default: