src/game.c

changeset 32
8a0b85303ee8
parent 31
ed440bcd9740
child 33
866025982aa9
     1.1 --- a/src/game.c	Tue Apr 08 21:13:28 2014 +0200
     1.2 +++ b/src/game.c	Wed Apr 09 09:34:07 2014 +0200
     1.3 @@ -153,8 +153,8 @@
     1.4  static int domove_singlemachine(GameState *gamestate, GameInfo *gameinfo) {
     1.5      
     1.6      const size_t buflen = 8;
     1.7 +    size_t bufpos = 0;
     1.8      char movestr[buflen];
     1.9 -    movestr[0] = '\0';
    1.10      
    1.11      int inputy = getmaxy(stdscr) - 6;
    1.12      while (1) {
    1.13 @@ -167,7 +167,7 @@
    1.14          clrtoeol();
    1.15          refresh();
    1.16          
    1.17 -        if (asyncgetnstr(movestr, buflen)) {
    1.18 +        if (asyncgetnstr(movestr, &bufpos, buflen)) {
    1.19              if (strncmp(movestr, "surr", buflen) == 0) {
    1.20                  printw("%s surrendered!",
    1.21                      gamestate->mycolor==WHITE?"White":"Black");
    1.22 @@ -206,7 +206,6 @@
    1.23                  }
    1.24                  clrtoeol();
    1.25              }
    1.26 -            movestr[0] = '\0'; /* reset string for next input */
    1.27          }
    1.28      }
    1.29  }

mercurial