src/main.c

changeset 157
07cbfc477b22
parent 154
5336e985bd69
equal deleted inserted replaced
156:05fc8a454700 157:07cbfc477b22
277 277
278 return 0; 278 return 0;
279 } 279 }
280 280
281 static void draw_board(GameState *gamestate, uint8_t perspective) { 281 static void draw_board(GameState *gamestate, uint8_t perspective) {
282 char fen[FEN_MAX_LENGTH]; 282 if (gamestate->movecount == 0) {
283 fen_compute(fen, gamestate); 283 mvaddstr(0, 0, gamestate->fen_start);
284 mvaddstr(0, 0, fen); 284 } else {
285 mvaddstr(0, 0, gamestate->fen[gamestate->movecount - 1]);
286 }
285 287
286 for (uint8_t y = 0 ; y < 8 ; y++) { 288 for (uint8_t y = 0 ; y < 8 ; y++) {
287 for (uint8_t x = 0 ; x < 8 ; x++) { 289 for (uint8_t x = 0 ; x < 8 ; x++) {
288 uint8_t col = gamestate->board[y][x] & COLOR_MASK; 290 uint8_t col = gamestate->board[y][x] & COLOR_MASK;
289 uint8_t piece = gamestate->board[y][x]; 291 uint8_t piece = gamestate->board[y][x];

mercurial