diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-04-02 02:25:52 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-04-02 02:25:52 +0200 |
commit | ea84b6a14d3ec90e44f11859f99833b4db10516f (patch) | |
tree | b41b25974724bb91dc6e652fe3badf599b91f691 /FICS | |
parent | b355c9b63e69fc8bb590c3ff7bfeaf1f3875208e (diff) |
Revised DisplayRankedPlayers()
Diffstat (limited to 'FICS')
-rw-r--r-- | FICS/ratings.c | 81 |
1 files changed, 43 insertions, 38 deletions
diff --git a/FICS/ratings.c b/FICS/ratings.c index 48160da..1cebfd4 100644 --- a/FICS/ratings.c +++ b/FICS/ratings.c @@ -1449,46 +1449,51 @@ PUBLIC int DisplayTargetRank(int p, char *target, int show, int showComp) return (1); } -PUBLIC int DisplayRankedPlayers(int p, int start, int end, - int show, int showComp) +PUBLIC int +DisplayRankedPlayers(int p, int start, int end, int show, int showComp) { - int num = end - start + 1; - FILE *fb = NULL, *fs = NULL, *fw = NULL; - char Path[MAX_FILENAME_SIZE]; + FILE *fb = NULL; + FILE *fs = NULL; + FILE *fw = NULL; + char Path[MAX_FILENAME_SIZE] = { '\0' }; + int num = (end - start + 1); + + if (start <= 0) + start = 1; + if (num <= 0) + return 0; + if (num > 100) + num = 100; + + if (CheckFlag(show, SHOW_BLITZ)) { + GetRankFileName(Path, TYPE_BLITZ); + + if ((fb = fopen(Path, "r")) == NULL) + ClearFlag(show, SHOW_BLITZ); + } + if (CheckFlag(show, SHOW_STANDARD)) { + GetRankFileName(Path, TYPE_STAND); - if (start <= 0) - start = 1; - if (num <= 0) - return 0; - if (num > 100) - num = 100; - if (CheckFlag(show, SHOW_BLITZ)) { - GetRankFileName(Path, TYPE_BLITZ); - fb = (FILE *) fopen(Path, "r"); - if (fb == NULL) - ClearFlag(show, SHOW_BLITZ); - } - if (CheckFlag(show, SHOW_STANDARD)) { - GetRankFileName(Path, TYPE_STAND); - fs = (FILE *) fopen(Path, "r"); - if (fs == NULL) - ClearFlag(show, SHOW_STANDARD); - } - if (CheckFlag(show, SHOW_WILD)) { - GetRankFileName(Path, TYPE_WILD); - fw = (FILE *) fopen(Path, "r"); - if (fw == NULL) - ClearFlag(show, SHOW_WILD); - } - ShowRankLines(p, fb, fs, fw, start, start, start, - num, showComp, show, ""); - if (fb) - fclose(fb); - if (fs) - fclose(fs); - if (fw) - fclose(fw); - return 1; + if ((fs = fopen(Path, "r")) == NULL) + ClearFlag(show, SHOW_STANDARD); + } + if (CheckFlag(show, SHOW_WILD)) { + GetRankFileName(Path, TYPE_WILD); + + if ((fw = fopen(Path, "r")) == NULL) + ClearFlag(show, SHOW_WILD); + } + + ShowRankLines(p, fb, fs, fw, start, start, start, num, showComp, show, + ""); + + if (fb) + fclose(fb); + if (fs) + fclose(fs); + if (fw) + fclose(fw); + return 1; } PUBLIC int |