(new_work, do_feed, prod, newe): Factor out calculation of work into

new_work().

(ROLLOVER_AVAIL, opt_ROLLOVER_AVAIL, opt_ROLLOVER_AVAIL, Options,
rollover_avail_max, configkeys, vers, new_work): Replace option
ROLLOVER_AVAIL by configuration parameter rollover_avail_max.
This commit is contained in:
Markus Armbruster 2004-05-10 20:30:38 +00:00
parent b665d57de1
commit 7f4e59fb8d
9 changed files with 19 additions and 28 deletions

View file

@ -80,12 +80,7 @@ do_feed(struct sctstr *sp, struct natstr *np, short *vec,
civvies = (vec[I_CIVIL] > maxpop) ? maxpop : vec[I_CIVIL];
uws = (vec[I_UW] > maxpop) ? maxpop : vec[I_UW];
mil = (vec[I_MILIT] > maxpop) ? maxpop : vec[I_MILIT];
work_avail = total_work(sctwork, etu, civvies, mil, uws);
if (opt_ROLLOVER_AVAIL) {
if (sp->sct_type == sp->sct_newtype) {
work_avail += sp->sct_avail;
}
}
work_avail = new_work(sp, total_work(sctwork, etu, civvies, mil, uws));
people = vec[I_CIVIL] + vec[I_MILIT] + vec[I_UW];
if (sp->sct_type != SCT_SANCT) {
@ -149,6 +144,15 @@ do_feed(struct sctstr *sp, struct natstr *np, short *vec,
return sctwork;
}
int
new_work(struct sctstr *sp, int delta)
{
if (sp->sct_type == sp->sct_newtype)
return min(rollover_avail_max, sp->sct_avail) + delta;
return delta;
}
static int
growfood(struct sctstr *sp, short *vec, int work, int etu)
{