(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:
parent
b665d57de1
commit
7f4e59fb8d
9 changed files with 19 additions and 28 deletions
|
@ -177,6 +177,7 @@ extern double eatrate;
|
|||
extern double fcrate;
|
||||
extern double fgrate;
|
||||
extern double obrate;
|
||||
extern int rollover_avail_max;
|
||||
extern double decay_per_etu;
|
||||
extern double fallout_spread;
|
||||
extern float drnuke_const;
|
||||
|
|
|
@ -551,6 +551,7 @@ extern int dodistribute(struct sctstr *, int, s_char *, double, double);
|
|||
/* finish.c */
|
||||
extern void finish_sects(int);
|
||||
/* human.c */
|
||||
extern int new_work(struct sctstr *, int);
|
||||
extern int do_feed(register struct sctstr *, register struct natstr *,
|
||||
short *, int *, int *, int);
|
||||
extern int feed_people(short *, int, int *);
|
||||
|
|
|
@ -82,14 +82,7 @@ newe(void)
|
|||
wforce = (int)((civs * sect.sct_work) / 100.0
|
||||
+ uws + sect.sct_item[I_MILIT] * 2 / 5.0);
|
||||
|
||||
work = etu_per_update * wforce / 100.0;
|
||||
if (opt_ROLLOVER_AVAIL) {
|
||||
if (sect.sct_type == sect.sct_newtype) {
|
||||
work += sect.sct_avail;
|
||||
}
|
||||
if (work > 999) work = 999;
|
||||
}
|
||||
|
||||
work = new_work(§, wforce * etu_per_update / 100);
|
||||
bwork = work / 2;
|
||||
|
||||
type = sect.sct_type;
|
||||
|
|
|
@ -134,13 +134,7 @@ prod(void)
|
|||
wforce = (int)(((double)civs * sect.sct_work) / 100.0
|
||||
+ uws
|
||||
+ sect.sct_item[I_MILIT] * 2.0 / 5.0);
|
||||
work = (double)etu_per_update *(double)wforce / 100.0;
|
||||
if (opt_ROLLOVER_AVAIL) {
|
||||
if (sect.sct_type == sect.sct_newtype) {
|
||||
work += sect.sct_avail;
|
||||
}
|
||||
if (work > 999) work = 999;
|
||||
}
|
||||
work = new_work(§, wforce * etu_per_update / 100);
|
||||
bwork = work / 2;
|
||||
|
||||
if (sect.sct_off)
|
||||
|
|
|
@ -95,6 +95,8 @@ vers(void)
|
|||
pr("1000 civilians generate $%.2f, uncompensated workers $%.2f each time unit.\n", 1000.0 * money_civ, 1000.0 * money_uw);
|
||||
pr("1000 active military cost $%.2f, reserves cost $%.2f.\n",
|
||||
-money_mil * 1000.0, -money_res * 1000.0);
|
||||
if (rollover_avail_max)
|
||||
pr("Up to %d avail can roll over an update.\n", rollover_avail_max);
|
||||
if (opt_SLOW_WAR)
|
||||
pr("Declaring war will cost you $%i\n\n", War_Cost);
|
||||
pr("Happiness p.e. requires 1 happy stroller per %d civ.\n",
|
||||
|
|
|
@ -285,6 +285,8 @@ struct keymatch configkeys[] = {
|
|||
"Food growth rate (* fertility of sector)"},
|
||||
{"obrate", doubleset, (caddr_t)&obrate, 0,
|
||||
"Civilian birth rate"},
|
||||
{"rollover_avail_max", intset, (caddr_t)&rollover_avail_max, 0,
|
||||
"Maximum avail that can roll over an update"},
|
||||
|
||||
{"", intset, (caddr_t)&emp_config_dummy, 0, "\n\n### Nukes"},
|
||||
{"decay_per_etu", doubleset, (caddr_t)&decay_per_etu, 0,
|
||||
|
|
|
@ -119,6 +119,7 @@ double babyeat = 0.0060; /* food to mature 1 baby into a civilian */
|
|||
double obrate = 0.005; /* other sectors birth rate */
|
||||
double uwbrate = 0.0025; /* uncompensated worker birth rate */
|
||||
/* values > 0.25 for either will overflow */
|
||||
int rollover_avail_max = 0; /* max. avail that can roll over an update */
|
||||
|
||||
/* opt_FALLOUT */
|
||||
/* these are the radioactive decay constants */
|
||||
|
|
|
@ -297,12 +297,6 @@ int opt_TECH_POP = 1;
|
|||
int opt_TECH_POP = 0;
|
||||
#endif
|
||||
|
||||
#ifdef ROLLOVER_AVAIL
|
||||
int opt_ROLLOVER_AVAIL = 1;
|
||||
#else
|
||||
int opt_ROLLOVER_AVAIL = 0;
|
||||
#endif
|
||||
|
||||
struct option_list Options[] = {
|
||||
{"ALL_BLEED", &opt_ALL_BLEED},
|
||||
{"BIG_CITY", &opt_BIG_CITY},
|
||||
|
@ -337,7 +331,6 @@ struct option_list Options[] = {
|
|||
{"PINPOINTMISSILE", &opt_PINPOINTMISSILE},
|
||||
{"PLANENAMES", &opt_PLANENAMES},
|
||||
{"RES_POP", &opt_RES_POP},
|
||||
{"ROLLOVER_AVAIL", &opt_ROLLOVER_AVAIL},
|
||||
{"SAIL", &opt_SAIL},
|
||||
{"SHIPNAMES", &opt_SHIPNAMES},
|
||||
{"SHOWPLANE", &opt_SHOWPLANE},
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue