Don't produce food without work
We don't want to starve tiny populations, because that would require players to move trivial amounts of food after explore and such. growfood() used to simply grow at least 1f when a sector was about to starve. That food is almost never eaten by a tiny population, so we effectively got some production without work. Fix by taking away that free food after people ate, in do_feed().
This commit is contained in:
parent
dc9d847b8b
commit
95298986cc
1 changed files with 8 additions and 6 deletions
|
@ -61,6 +61,7 @@ do_feed(struct sctstr *sp, struct natstr *np, short *vec,
|
|||
int starved, sctwork;
|
||||
int needed;
|
||||
int maxpop;
|
||||
int manna;
|
||||
|
||||
/* grow people & stuff */
|
||||
sctwork = sp->sct_work;
|
||||
|
@ -72,12 +73,16 @@ do_feed(struct sctstr *sp, struct natstr *np, short *vec,
|
|||
maxpop));
|
||||
|
||||
if (sp->sct_type != SCT_SANCT) {
|
||||
manna = 0;
|
||||
if (opt_NOFOOD == 0) {
|
||||
needed = (int)ceil(food_needed(vec, etu));
|
||||
if (vec[I_FOOD] < needed) {
|
||||
/* need to grow "emergency rations" */
|
||||
work_avail -= 2 * growfood(sp, vec, work_avail / 2, etu);
|
||||
/* It's twice as hard to grow those than norm */
|
||||
if (vec[I_FOOD] == 0)
|
||||
/* Conjure up 1f to make life easier for the player */
|
||||
manna = vec[I_FOOD] = 1;
|
||||
}
|
||||
if (vec[I_FOOD] < needed && sp->sct_own == sp->sct_oldown) {
|
||||
/* steal food from warehouses, headquarters,
|
||||
|
@ -121,6 +126,9 @@ do_feed(struct sctstr *sp, struct natstr *np, short *vec,
|
|||
sp->sct_x, sp->sct_y, oldche, sp->sct_che);
|
||||
}
|
||||
}
|
||||
if (manna)
|
||||
/* Take away food we conjured up */
|
||||
vec[I_FOOD] = 0;
|
||||
} else
|
||||
sctwork = sp->sct_work = 100;
|
||||
/* Here is where we truncate extra people, always */
|
||||
|
@ -152,13 +160,7 @@ growfood(struct sctstr *sp, short *vec, int work, int etu)
|
|||
food = MIN(food_workers, food_fertil);
|
||||
if (food > ITEM_MAX - vec[I_FOOD])
|
||||
food = ITEM_MAX - vec[I_FOOD];
|
||||
/*
|
||||
* Be nice; grow minimum one food unit.
|
||||
* This makes life simpler for the player.
|
||||
*/
|
||||
vec[I_FOOD] += food;
|
||||
if (vec[I_FOOD] == 0)
|
||||
vec[I_FOOD] = 1;
|
||||
work_used = food / fcrate;
|
||||
return work_used;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue