src/game.c

changeset 28
0c1371488d87
parent 27
efeb98bc69c9
child 30
a285ee393860
     1.1 --- a/src/game.c	Thu Apr 03 16:07:04 2014 +0200
     1.2 +++ b/src/game.c	Fri Apr 04 17:36:42 2014 +0200
     1.3 @@ -106,7 +106,7 @@
     1.4              }
     1.5              if (!logelem->next) {
     1.6                  if (gamestate->checkmate) {
     1.7 -                    addch('#');
     1.8 +                    addstr("\b#");
     1.9                  } else if (gamestate->stalemate) {
    1.10                      addstr(" stalemate");
    1.11                  }
    1.12 @@ -343,9 +343,9 @@
    1.13  
    1.14  void game_start_singlemachine(Settings *settings) {
    1.15      GameState gamestate;
    1.16 +    memset(&gamestate, 0, sizeof(GameState));
    1.17      init_board(&gamestate);
    1.18      gamestate.mycolor = WHITE;
    1.19 -    gamestate.movelist = gamestate.lastmove = NULL;
    1.20      // TODO: time limit
    1.21      _Bool running;
    1.22      do {
    1.23 @@ -354,6 +354,8 @@
    1.24          running = !domove_singlemachine(&gamestate);
    1.25          gamestate.mycolor = opponent_color(gamestate.mycolor);
    1.26      }  while (running);
    1.27 +    move(0,0);
    1.28 +    draw_board(&gamestate);
    1.29      
    1.30      gamestate_cleanup(&gamestate);
    1.31      
    1.32 @@ -369,9 +371,9 @@
    1.33      
    1.34      // TODO: time limit
    1.35      GameState gamestate;
    1.36 +    memset(&gamestate, 0, sizeof(GameState));
    1.37      init_board(&gamestate);
    1.38      gamestate.mycolor = myturn ? WHITE:BLACK;
    1.39 -    gamestate.movelist = gamestate.lastmove = NULL;
    1.40      
    1.41      _Bool running;
    1.42      do {
    1.43 @@ -386,6 +388,9 @@
    1.44          myturn ^= TRUE;
    1.45      }  while (running);
    1.46      
    1.47 +    move(0,0);
    1.48 +    draw_board(&gamestate);
    1.49 +    
    1.50      gamestate_cleanup(&gamestate);
    1.51      
    1.52      mvaddstr(getmaxy(stdscr)-1, 0,

mercurial