diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-05-04 16:23:41 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-05-04 16:23:41 +0200 |
commit | c55e63df09594ca00dba443b8cee557236bd3306 (patch) | |
tree | 75463b0bfda4a2bf49a131b6db4dd56e17684ac3 | |
parent | 82d610689ac141b1cca6db796095fe92152d56a1 (diff) |
Reformatted game_isblitz()
-rw-r--r-- | FICS/gamedb.c | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/FICS/gamedb.c b/FICS/gamedb.c index b9be601..f2e5fda 100644 --- a/FICS/gamedb.c +++ b/FICS/gamedb.c @@ -208,28 +208,35 @@ PUBLIC char *game_str(int rated, int wt, int winc, int bt, int binc, return tstr; } -PUBLIC int game_isblitz(int wt, int winc, int bt, int binc, - char *cat, char *board) +PUBLIC int +game_isblitz(int wt, int winc, int bt, int binc, char *cat, char *board) { - int total; + int total; + + if (cat && cat[0] && board && board[0] && (!strcmp(cat, "wild"))) + return TYPE_WILD; + if (cat && cat[0] && board && board[0] && (strcmp(cat, "standard") || + strcmp(board, "standard"))) + return TYPE_NONSTANDARD; + + if (((wt == 0) && (winc == 0)) || ((bt == 0) && (binc == 0))) { + /* + * nonsense if one is timed and one is not + */ + return TYPE_UNTIMED; + } - if (cat && cat[0] && board && board[0] && (!strcmp(cat, "wild"))) - return TYPE_WILD; - if (cat && cat[0] && board && board[0] && - (strcmp(cat, "standard") || strcmp(board, "standard"))) - return TYPE_NONSTANDARD; - if (((wt == 0) && (winc == 0)) || ((bt == 0) && (binc == 0))) - /* nonsense if one is timed and one is not */ - return TYPE_UNTIMED; - if ((wt != bt) || (winc != binc)) - return TYPE_NONSTANDARD; - total = wt * 60 + winc * 40; - if (total < 180) /* 3 minute */ - return TYPE_LIGHT; - if (total >= 900) /* 15 minutes */ - return TYPE_STAND; - else - return TYPE_BLITZ; + if ((wt != bt) || (winc != binc)) + return TYPE_NONSTANDARD; + + total = wt * 60 + winc * 40; + + if (total < 180) // 3 minutes + return TYPE_LIGHT; + if (total >= 900) // 15 minutes + return TYPE_STAND; + else + return TYPE_BLITZ; } PUBLIC void |