commit - 2d6837125d08ccdf7a5eb3d57d172c6dfb87c386
commit + fb3a67dfbb757a005d451907b9640de02a303380
blob - 033d1458a8a4f8891db0e632ab5f8d99cb533364
blob + 431523942f3d1177cda27d4da67bc9e42c7a65c2
--- FICS/formula.c
+++ FICS/formula.c
else return (ERR_PAREN);
}
-int Maxtime (game *g, int numMoves, int numPlayers)
+int
+Maxtime(game *g, int numMoves, int numPlayers)
{
- int max;
+ int max;
- if ((g->bInitTime == g->wInitTime) && (g->bIncrement == g->wIncrement)) {
- max = numPlayers * (60 * g->wInitTime + numMoves * g->wIncrement);
- if ((g->type != TYPE_UNTIMED) && (g->wInitTime == 0))
- max +=10 * numPlayers; /* 0 x start with ten secs */
+ if (g->bInitTime == g->wInitTime && g->bIncrement == g->wIncrement) {
+ max = numPlayers * (60 * g->wInitTime + numMoves *
+ g->wIncrement);
- } else if (numPlayers == 2) {
- max = 60 * (g->wInitTime + g->bInitTime)
- + numMoves * (g->wIncrement + g->bIncrement);
- if ((g->type != TYPE_UNTIMED) && (g->wInitTime == 0))
- max +=10; /* 0 x start with ten secs */
- if ((g->type != TYPE_UNTIMED) && (g->bInitTime == 0))
- max +=10; /* 0 x start with ten secs */
+ if (g->type != TYPE_UNTIMED && g->wInitTime == 0)
+ max += (10 * numPlayers);
+ } else if (numPlayers == 2) {
+ max = 60 * (g->wInitTime + g->bInitTime) + numMoves *
+ (g->wIncrement + g->bIncrement);
- } else {
- max = 60 * g->bInitTime + numMoves * g->bIncrement;
- if ((g->type != TYPE_UNTIMED) && (g->bInitTime == 0))
- max +=10; /* 0 x start with ten secs */
- }
+ if (g->type != TYPE_UNTIMED && g->wInitTime == 0)
+ max += 10;
+ if (g->type != TYPE_UNTIMED && g->bInitTime == 0)
+ max += 10;
+ } else {
+ max = (60 * g->bInitTime + numMoves * g->bIncrement);
- return max;
+ if (g->type != TYPE_UNTIMED && g->bInitTime == 0)
+ max += 10;
+ }
+ return max;
}
-
/*
* The black player in game 'g' has been challenged. S/he has a list
* of formulas and we're checking the one given by the index