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