forked from github/server
log10(0) ist nicht erlaubt.
This commit is contained in:
parent
20c9112b07
commit
21fcb3d167
|
@ -67,9 +67,10 @@
|
|||
#include <language.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -1248,9 +1248,12 @@ count_maxmigrants(const faction * f)
|
|||
{
|
||||
int x = 0;
|
||||
if (old_race(f->race) == RC_HUMAN) {
|
||||
x = (int)(log10(count_all(f) / 50.0) * 20);
|
||||
int nsize = count_all(f);
|
||||
if (nsize>0) {
|
||||
x = (int)(log10(nsize / 50.0) * 20);
|
||||
if (x < 0) x = 0;
|
||||
}
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
|
|
|
@ -1136,8 +1136,12 @@ unitlist_insert(struct unit_list **ul, struct unit *u)
|
|||
int
|
||||
maxheroes(const struct faction * f)
|
||||
{
|
||||
int nmax = (int)(log10(count_all(f) / 50.0) * 20);
|
||||
int nsize = count_all(f);
|
||||
if (nsize==0) return 0;
|
||||
else {
|
||||
int nmax = (int)(log10(nsize / 50.0) * 20);
|
||||
return (nmax<0)?0:nmax;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
/* util includes */
|
||||
#include <util/base36.h>
|
||||
#include <util/sql.h>
|
||||
#include <util/goodies.h>
|
||||
#include <util/sql.h>
|
||||
|
||||
|
|
Loading…
Reference in New Issue