src/chess/rules.c

changeset 67
c76e46970a59
parent 66
f5cc75565f7c
child 68
b34de5ce7d0e
equal deleted inserted replaced
66:f5cc75565f7c 67:c76e46970a59
69 elem = elem->next; 69 elem = elem->next;
70 free(cur); 70 free(cur);
71 }; 71 };
72 } 72 }
73 73
74 /* MUST be called BEFORE applying a move to work correctly */ 74 /* MUST be called BETWEEN validating AND applying a move to work correctly */
75 static void format_move(GameState *gamestate, Move *move) { 75 static void format_move(GameState *gamestate, Move *move) {
76 char *string = &(move->string[0]); 76 char *string = &(move->string[0]);
77 77
78 /* at least 8 characters should be available, wipe them out */ 78 /* at least 8 characters should be available, wipe them out */
79 memset(string, 0, 8); 79 memset(string, 0, 8);
152 } 152 }
153 } 153 }
154 154
155 /* check? */ 155 /* check? */
156 if (move->check) { 156 if (move->check) {
157 // TODO: does not work, because checkmate is not set when format_move is called
158 string[idx++] = gamestate->checkmate?'#':'+'; 157 string[idx++] = gamestate->checkmate?'#':'+';
159 } 158 }
160 } 159 }
161 160
162 static void addmove(GameState* gamestate, Move *move) { 161 static void addmove(GameState* gamestate, Move *move) {

mercurial