src/game.c

changeset 110
e2bb03494d46
parent 104
0f69fe56a4cd
equal deleted inserted replaced
109:6b07e7ed8f46 110:e2bb03494d46
80 mvaddstr(0, 0, fen); 80 mvaddstr(0, 0, fen);
81 81
82 for (uint8_t y = 0 ; y < 8 ; y++) { 82 for (uint8_t y = 0 ; y < 8 ; y++) {
83 for (uint8_t x = 0 ; x < 8 ; x++) { 83 for (uint8_t x = 0 ; x < 8 ; x++) {
84 uint8_t col = gamestate->board[y][x] & COLOR_MASK; 84 uint8_t col = gamestate->board[y][x] & COLOR_MASK;
85 uint8_t piece = gamestate->board[y][x] & PIECE_MASK; 85 uint8_t piece = gamestate->board[y][x];
86 char piecestr[5]; 86 char piecestr[5];
87 if (piece) { 87 if (piece) {
88 if (unicode) { 88 if (unicode) {
89 char* uc = getpieceunicode(piece); 89 char* uc = getpieceunicode(piece);
90 strncpy(piecestr, uc, 5); 90 strncpy(piecestr, uc, 5);
91 } else { 91 } else {
92 piecestr[0] = piece == PAWN ? 'P' : getpiecechr(piece); 92 piecestr[0] = (piece & PIECE_MASK) == PAWN
93 ? 'P' : getpiecechr(piece);
93 piecestr[1] = '\0'; 94 piecestr[1] = '\0';
94 } 95 }
95 } else { 96 } else {
96 piecestr[0] = ' '; 97 piecestr[0] = ' ';
97 piecestr[1] = '\0'; 98 piecestr[1] = '\0';

mercurial