aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/gamedb.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-17 14:36:51 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-17 14:36:51 +0100
commit0aac028c17222136ee7d0aa6622ed25b85e126d3 (patch)
treef8a97509fe2582f3f9ff312c44ee9eaef3b9c6c8 /FICS/gamedb.c
parentcbb50a9174a7139d1c18546be966d4c9a27bac85 (diff)
Reformatted ReadV1GameFmt()
Diffstat (limited to 'FICS/gamedb.c')
-rw-r--r--FICS/gamedb.c62
1 files changed, 35 insertions, 27 deletions
diff --git a/FICS/gamedb.c b/FICS/gamedb.c
index f552aa2..33a9628 100644
--- a/FICS/gamedb.c
+++ b/FICS/gamedb.c
@@ -1008,34 +1008,42 @@ int ReadV1Moves(game *g, FILE * fp)
return 0;
}
-int ReadV1GameFmt(game *g, FILE * fp, char *file, int version)
+int
+ReadV1GameFmt(game *g, FILE *fp, char *file, int version)
{
- fscanf(fp, "%s %s", g->white_name, g->black_name);
- fscanf(fp, "%d %d", &g->white_rating, &g->black_rating);
- fscanf(fp, "%d %d %d %d", &g->wInitTime, &g->wIncrement,
- &g->bInitTime, &g->bIncrement);
- if ((version < 3) && (!(g->bInitTime)))
- g->bInitTime = g->wInitTime;
- /*PRE-V3 assumed bInitTime was 0 if balanced clocks*/
- fscanf(fp, "%lx", &g->timeOfStart);
- fscanf(fp, "%d %d", &g->wTime, &g->bTime);
-
-/* fixing an (apparently) old bug: winner not saved */
- if (version > 1)
- fscanf(fp, "%d %d", &g->result, &g->winner);
- else
- fscanf(fp, "%d", &g->result);
-
- fscanf(fp, "%d %d %d %d", &g->private, &g->type,
- &g->rated, &g->clockStopped);
- fscanf(fp, "%d", &g->numHalfMoves);
- ReadV1Moves(g, fp);
- if (g->status != GAME_EXAMINE
- && ReadGameState(fp, &g->game_state, version)) {
- fprintf(stderr, "FICS: Trouble reading game state from %s.\n", file);
- return -1;
- }
- return 0;
+ fscanf(fp, "%s %s", g->white_name, g->black_name);
+ fscanf(fp, "%d %d", &g->white_rating, &g->black_rating);
+ fscanf(fp, "%d %d %d %d",
+ &g->wInitTime,
+ &g->wIncrement,
+ &g->bInitTime,
+ &g->bIncrement);
+
+ if ((version < 3) && (!(g->bInitTime)))
+ g->bInitTime = g->wInitTime;
+
+ fscanf(fp, "%lx", &g->timeOfStart);
+ fscanf(fp, "%d %d", &g->wTime, &g->bTime);
+
+ if (version > 1)
+ fscanf(fp, "%d %d", &g->result, &g->winner);
+ else
+ fscanf(fp, "%d", &g->result);
+
+ fscanf(fp, "%d %d %d %d", &g->private, &g->type, &g->rated,
+ &g->clockStopped);
+ fscanf(fp, "%d", &g->numHalfMoves);
+
+ ReadV1Moves(g, fp);
+
+ if (g->status != GAME_EXAMINE &&
+ ReadGameState(fp, &g->game_state, version)) {
+ fprintf(stderr, "FICS: Trouble reading game state from %s.\n",
+ file);
+ return -1;
+ }
+
+ return 0;
}
PUBLIC int ReadGameAttrs(FILE * fp, char *fname, int g)