From c55e63df09594ca00dba443b8cee557236bd3306 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sat, 4 May 2024 16:23:41 +0200 Subject: Reformatted game_isblitz() --- FICS/gamedb.c | 47 +++++++++++++++++++++++++++-------------------- 1 file 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 -- cgit v1.2.3