src/game.c

changeset 28
0c1371488d87
parent 27
efeb98bc69c9
child 30
a285ee393860
--- a/src/game.c	Thu Apr 03 16:07:04 2014 +0200
+++ b/src/game.c	Fri Apr 04 17:36:42 2014 +0200
@@ -106,7 +106,7 @@
             }
             if (!logelem->next) {
                 if (gamestate->checkmate) {
-                    addch('#');
+                    addstr("\b#");
                 } else if (gamestate->stalemate) {
                     addstr(" stalemate");
                 }
@@ -343,9 +343,9 @@
 
 void game_start_singlemachine(Settings *settings) {
     GameState gamestate;
+    memset(&gamestate, 0, sizeof(GameState));
     init_board(&gamestate);
     gamestate.mycolor = WHITE;
-    gamestate.movelist = gamestate.lastmove = NULL;
     // TODO: time limit
     _Bool running;
     do {
@@ -354,6 +354,8 @@
         running = !domove_singlemachine(&gamestate);
         gamestate.mycolor = opponent_color(gamestate.mycolor);
     }  while (running);
+    move(0,0);
+    draw_board(&gamestate);
     
     gamestate_cleanup(&gamestate);
     
@@ -369,9 +371,9 @@
     
     // TODO: time limit
     GameState gamestate;
+    memset(&gamestate, 0, sizeof(GameState));
     init_board(&gamestate);
     gamestate.mycolor = myturn ? WHITE:BLACK;
-    gamestate.movelist = gamestate.lastmove = NULL;
     
     _Bool running;
     do {
@@ -386,6 +388,9 @@
         myturn ^= TRUE;
     }  while (running);
     
+    move(0,0);
+    draw_board(&gamestate);
+    
     gamestate_cleanup(&gamestate);
     
     mvaddstr(getmaxy(stdscr)-1, 0,

mercurial