src/main.c

changeset 133
c58ae152733e
parent 132
5762f2b5f87a
--- a/src/main.c	Sun Jun 07 16:56:22 2026 +0200
+++ b/src/main.c	Fri Jun 12 13:34:35 2026 +0200
@@ -279,7 +279,7 @@
 }
 
 static void draw_board(GameState *gamestate, uint8_t perspective) {
-    char fen[90];
+    char fen[FEN_MAX_LENGTH];
     fen_compute(fen, gamestate);
     mvaddstr(0, 0, fen);
 
@@ -906,7 +906,7 @@
                 addstr("Game has ended. Use -S to analyze it.\n");
                 return;
             }
-            curcol = opponent_color(last_move(&gamestate).piece&COLOR_MASK);
+            curcol = current_color(&gamestate);
         } else {
             printw("Can't read PGN file (%s)\n", strerror(errno));
             return;
@@ -934,8 +934,7 @@
         mycolor = opponent_color(mycolor);
     }
 
-    bool myturn = (gamestate->movecount > 0 ?
-        (last_move(gamestate).piece & COLOR_MASK) : BLACK) != mycolor;
+    bool myturn = current_color(gamestate) == mycolor;
 
     bool running;
     do {

mercurial