diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2023-12-17 14:46:42 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2023-12-17 14:46:42 +0100 |
commit | 19db6b08fe8b2e261009c924257c84c9a1431fc9 (patch) | |
tree | e1561973085c277cb6bab99fc17132b85b97b367 /FICS/gamedb.c | |
parent | 0aac028c17222136ee7d0aa6622ed25b85e126d3 (diff) |
Reformatted WriteGameFile()
Diffstat (limited to 'FICS/gamedb.c')
-rw-r--r-- | FICS/gamedb.c | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/FICS/gamedb.c b/FICS/gamedb.c index 33a9628..f7d40a0 100644 --- a/FICS/gamedb.c +++ b/FICS/gamedb.c @@ -1164,32 +1164,35 @@ PUBLIC int game_delete(int wp, int bp) return 0; } -void WriteGameFile(FILE * fp, int g) +void +WriteGameFile(FILE *fp, int g) { - int i; - game *gg = &garray[g]; - player *wp = &parray[gg->white], *bp = &parray[gg->black]; - - fprintf(fp, "v %d\n", GAMEFILE_VERSION); - fprintf(fp, "%s %s\n", wp->name, bp->name); - fprintf(fp, "%d %d\n", gg->white_rating, gg->black_rating); - fprintf(fp, "%d %d %d %d\n", gg->wInitTime, gg->wIncrement, - gg->bInitTime, gg->bIncrement); - fprintf(fp, "%lx\n", gg->timeOfStart); -/* fprintf(fp, "%d %d\n", gg->wTime, gg->bTime); */ + game *gg = &garray[g]; + player *bp = &parray[gg->black]; + player *wp = &parray[gg->white]; + + fprintf(fp, "v %d\n", GAMEFILE_VERSION); + fprintf(fp, "%s %s\n", wp->name, bp->name); + fprintf(fp, "%d %d\n", gg->white_rating, gg->black_rating); + fprintf(fp, "%d %d %d %d\n", gg->wInitTime, gg->wIncrement, + gg->bInitTime, gg->bIncrement); + fprintf(fp, "%lx\n", gg->timeOfStart); + #ifdef TIMESEAL - fprintf(fp, "%d %d\n", - (con[wp->socket].timeseal ? gg->wRealTime/100 : gg->wTime), - (con[bp->socket].timeseal ? gg->bRealTime/100 : gg->bTime)); + fprintf(fp, "%d %d\n", + (con[wp->socket].timeseal ? (gg->wRealTime / 100) : gg->wTime), + (con[bp->socket].timeseal ? (gg->bRealTime / 100) : gg->bTime)); #endif - fprintf(fp, "%d %d\n", gg->result, gg->winner); - fprintf(fp, "%d %d %d %d\n", gg->private, gg->type, - gg->rated, gg->clockStopped); - fprintf(fp, "%d\n", gg->numHalfMoves); - for (i = 0; i < garray[g].numHalfMoves; i++) { - WriteMoves(fp, &garray[g].moveList[i]); - } - WriteGameState(fp, &garray[g].game_state); + + fprintf(fp, "%d %d\n", gg->result, gg->winner); + fprintf(fp, "%d %d %d %d\n", gg->private, gg->type, gg->rated, + gg->clockStopped); + fprintf(fp, "%d\n", gg->numHalfMoves); + + for (int i = 0; i < garray[g].numHalfMoves; i++) + WriteMoves(fp, &garray[g].moveList[i]); + + WriteGameState(fp, &garray[g].game_state); } PUBLIC int game_save(int g) |