src/chess/pgn.c

changeset 117
ee539a9691f0
parent 107
36dd94278142
child 118
0f2ffbc408ce
equal deleted inserted replaced
116:4bf18d42e7ee 117:ee539a9691f0
194 } 194 }
195 pos++; 195 pos++;
196 } 196 }
197 } 197 }
198 198
199 void write_pgn(FILE* stream, GameState *gamestate, GameInfo *gameinfo) { 199 void write_pgn(FILE* stream, GameState *gamestate, GameInfo *gameinfo,
200 bool export_comments) {
200 // TODO: tag pairs 201 // TODO: tag pairs
201 202
202 /* Result */ 203 /* Result */
203 char *result; 204 char *result;
204 if (gamestate->stalemate || gamestate->remis) { 205 if (gamestate->stalemate || gamestate->remis) {
247 } else { 248 } else {
248 snpr = snprintf(moveblkptr, 16, "%s", 249 snpr = snprintf(moveblkptr, 16, "%s",
249 gamestate->moves[i].string); 250 gamestate->moves[i].string);
250 } 251 }
251 moveblkptr += snpr; 252 moveblkptr += snpr;
253
254 if (!export_comments) {
255 *(moveblkptr++) = ' ';
256 continue;
257 }
252 258
253 /* add clock times when the game was under time control */ 259 /* add clock times when the game was under time control */
254 if (gameinfo->timecontrol) { 260 if (gameinfo->timecontrol) {
255 memcpy(moveblkptr, " {[%clk ", 8); 261 memcpy(moveblkptr, " {[%clk ", 8);
256 moveblkptr += 8; 262 moveblkptr += 8;

mercurial