forked from github/server
CID 22463 Division or modulo by zero
This commit is contained in:
parent
fff40f048b
commit
876e4122b1
|
@ -593,10 +593,12 @@ int skill_limit(faction * f, skill_t sk)
|
|||
if (sk != SK_ALCHEMY && sk != SK_MAGIC)
|
||||
return INT_MAX;
|
||||
if (f_get_alliance(f)) {
|
||||
int ac = listlen(f->alliance->members); /* number of factions */
|
||||
int fl = (al + ac - 1) / ac; /* faction limit, rounded up */
|
||||
int sc, fl, ac = listlen(f->alliance->members); /* number of factions */
|
||||
|
||||
assert(ac > 0);
|
||||
fl = (al + ac - 1) / ac; /* faction limit, rounded up */
|
||||
/* the faction limit may not be achievable because it would break the alliance-limit */
|
||||
int sc = al - allied_skillcount(f, sk);
|
||||
sc = al - allied_skillcount(f, sk);
|
||||
if (sc <= 0)
|
||||
return 0;
|
||||
return fl;
|
||||
|
|
Loading…
Reference in New Issue