aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/ratings.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-04-02 18:05:02 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-04-02 18:05:02 +0200
commit9ab3ef78312b118159eb4b9c382f48958bbc3386 (patch)
tree8dd4e6c448103dd48dcb2a255d6f9bfc15faeef4 /FICS/ratings.c
parent98399bfca79d89db320b64d75d6a4a8188ba310d (diff)
Reformatted ShowRankLines()
Diffstat (limited to 'FICS/ratings.c')
-rw-r--r--FICS/ratings.c92
1 files changed, 52 insertions, 40 deletions
diff --git a/FICS/ratings.c b/FICS/ratings.c
index 43098aa..1bfd10e 100644
--- a/FICS/ratings.c
+++ b/FICS/ratings.c
@@ -1350,48 +1350,60 @@ PRIVATE int CountAbove(int num, int blitz, int std, int wild, int which)
return (max <= (num + 1) / 2 ? max - 1 : (num + 1) / 2);
}
-PRIVATE int ShowRankLines(int p, FILE * fb, FILE * fs, FILE * fw, int bCount,
- int sCount, int wCount, int n, int showComp, int show, char *target)
+PRIVATE int
+ShowRankLines(int p, FILE *fb, FILE *fs, FILE *fw, int bCount, int sCount,
+ int wCount, int n, int showComp, int show, char *target)
{
- int lastBlitz = 9999, nTiedBlitz = 0;
- int lastStd = 9999, nTiedStd = 0;
- int lastWild = 9999, nTiedWild = 0;
- int i;
+ int lastBlitz = 9999, nTiedBlitz = 0;
+ int lastStd = 9999, nTiedStd = 0;
+ int lastWild = 9999, nTiedWild = 0;
- if (n <= 0)
- return 0;
- if (CheckFlag(show, SHOW_BLITZ)) {
- PositionFilePtr(fb, bCount, &lastBlitz, &nTiedBlitz, showComp);
- if (feof(fb))
- ClearFlag(show, SHOW_BLITZ);
- }
- if (CheckFlag(show, SHOW_STANDARD)) {
- PositionFilePtr(fs, sCount, &lastStd, &nTiedStd, showComp);
- if (feof(fs))
- ClearFlag(show, SHOW_STANDARD);
- }
- if (CheckFlag(show, SHOW_WILD)) {
- PositionFilePtr(fw, wCount, &lastWild, &nTiedWild, showComp);
- if (feof(fw))
- ClearFlag(show, SHOW_WILD);
- }
- if (!CheckFlag(show, SHOW_BLITZ | SHOW_STANDARD | SHOW_WILD))
- return 0;
- DisplayRankHead(p, show);
-
- for (i = 0; i < n && show; i++) {
- if (CheckFlag(show, SHOW_BLITZ))
- bCount += ShowRankEntry(p, fb, bCount, showComp, target,
- &lastBlitz, &nTiedBlitz);
- if (CheckFlag(show, SHOW_STANDARD))
- sCount += ShowRankEntry(p, fs, sCount, showComp, target,
- &lastStd, &nTiedStd);
- if (CheckFlag(show, SHOW_WILD))
- wCount += ShowRankEntry(p, fw, wCount, showComp, target,
- &lastWild, &nTiedWild);
- pprintf(p, "\n");
- }
- return 1;
+ if (n <= 0)
+ return 0;
+
+ if (CheckFlag(show, SHOW_BLITZ)) {
+ PositionFilePtr(fb, bCount, &lastBlitz, &nTiedBlitz, showComp);
+
+ if (feof(fb))
+ ClearFlag(show, SHOW_BLITZ);
+ }
+
+ if (CheckFlag(show, SHOW_STANDARD)) {
+ PositionFilePtr(fs, sCount, &lastStd, &nTiedStd, showComp);
+
+ if (feof(fs))
+ ClearFlag(show, SHOW_STANDARD);
+ }
+
+ if (CheckFlag(show, SHOW_WILD)) {
+ PositionFilePtr(fw, wCount, &lastWild, &nTiedWild, showComp);
+
+ if (feof(fw))
+ ClearFlag(show, SHOW_WILD);
+ }
+
+ if (!CheckFlag(show, (SHOW_BLITZ | SHOW_STANDARD | SHOW_WILD)))
+ return 0;
+
+ DisplayRankHead(p, show);
+
+ for (int i = 0; i < n && show; i++) {
+ if (CheckFlag(show, SHOW_BLITZ)) {
+ bCount += ShowRankEntry(p, fb, bCount, showComp, target,
+ &lastBlitz, &nTiedBlitz);
+ }
+ if (CheckFlag(show, SHOW_STANDARD)) {
+ sCount += ShowRankEntry(p, fs, sCount, showComp, target,
+ &lastStd, &nTiedStd);
+ }
+ if (CheckFlag(show, SHOW_WILD)) {
+ wCount += ShowRankEntry(p, fw, wCount, showComp, target,
+ &lastWild, &nTiedWild);
+ }
+ pprintf(p, "\n");
+ }
+
+ return 1;
}
PUBLIC int