(food_needed): New.

(feed_ship, feed_land): Use it.
(do_feed): Use it.  Estimate of food needed was one too large for
integer food needs.  Used to round fractional food need to nearest
instead of up for supply_commod(), which could cause starvation.
(s_commod, get_minimum): Use it.  Estimate of food needed was one too
large for integer food needs.  s_commod() used to reserve one more
than get_minimum() would have returned; it's now the same.

(famine_victims): New.
(feed_people): Use it.  This rounds victim fractions down instead of
up.  It also dosn't flush needs <=1 to zero.  Doesn't change
starvation, as do_feed() always produces at least one emergency food.
Does change food consumption.

(starve_some): New.
(feed_people): Use it.

(feed_ship): Use feed_people().  This rounds victim fractions down
instead of up.

(feed_land): Use feed_people().  Rounding of victim fractions
unchanged.  Feeds all people not just mil; closes #913997.

(starv_people): New.
(starv_sects, starv_ships, starv_units): Use it.  Fixes starve land to
talk about people instead of mil.

(starv_sects): Use famine_victims() rather than feed_people().  Take
emergency food into account, because feed_people() doesn't.  Don't aim
for one extra food, for consistency with starv_ships() and
starv_units().
(feed_people): Remove useless parameter.  Simplify.

(starv_ships, starv_ships): Use famine_victims() rather than
feed_ship() and feed_land().
(feed_ship, feed_land): Remove useless parameters.  Internal linkage.
Simplify.

(feed_land): Call resupply_commod() only if there's a food shortage.
Don't scrounge lnd_ship for food, resupply_commod() already does.
This commit is contained in:
Markus Armbruster 2006-05-26 18:22:42 +00:00
parent 0ac31b3ece
commit 109dad1bee
6 changed files with 119 additions and 203 deletions

View file

@ -730,10 +730,11 @@ extern void finish_sects(int);
extern int new_work(struct sctstr *, int);
extern int do_feed(struct sctstr *, struct natstr *,
short *, int *, int *, int);
extern int feed_people(short *, int, int *);
extern int feed_people(short *, int);
extern double food_needed(short *, int);
extern int famine_victims(short *, int);
/* land.c */
extern int prod_land(int, int, int *, int);
extern int feed_land(struct lndstr *, int, int *, int);
/* main.c */
/* in server.h */
/* material.c */
@ -796,7 +797,6 @@ extern void produce_sect(int natnum, int etu, int *bp,
long (*p_sect)[2], int sector_type);
/* ship.c */
extern int prod_ship(int, int, int *, int);
extern int feed_ship(struct shpstr *, int, int *, int);
/*
* src/server