Don't make more babies than food permits

babies() rounded the maximum number of babies permitted by food.  When
this rounded up, grow_people() could use more food than available, and
the sector's food could become negative.  Fix by always rounding down.
This commit is contained in:
Markus Armbruster 2008-03-30 18:28:07 +02:00
parent fc6f1da568
commit 1f9e884525

View file

@ -273,7 +273,7 @@ babies(int adults, int etu, double brate, int food, int maxpop)
if (opt_NOFOOD) if (opt_NOFOOD)
new_food = new_birth; new_food = new_birth;
else else
new_food = (int)(0.5 + food / (2.0 * babyeat)); new_food = (int)(food / (2.0 * babyeat));
new = new_birth; new = new_birth;
if (new > new_food) if (new > new_food)