]> git.pond.sub.org Git - empserver/commitdiff
Don't make more babies than food permits
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 30 Mar 2008 16:28:07 +0000 (18:28 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 1 Apr 2008 18:05:10 +0000 (20:05 +0200)
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.

src/lib/update/human.c

index 5280693882b05c4f86527e3d88e2df44e76b3f3a..1a7b1c5fcb46b4f606f6e4a86681d463fcb2f162 100644 (file)
@@ -273,7 +273,7 @@ babies(int adults, int etu, double brate, int food, int maxpop)
     if (opt_NOFOOD)
        new_food = new_birth;
     else
-       new_food = (int)(0.5 + food / (2.0 * babyeat));
+       new_food = (int)(food / (2.0 * babyeat));
 
     new = new_birth;
     if (new > new_food)