update: Track levels in nat_budget[]
Replace levels[][] by nat_budget[].level[]. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
35d6779e55
commit
d861902783
4 changed files with 18 additions and 18 deletions
|
@ -60,6 +60,8 @@ struct budg_item {
|
||||||
struct budget {
|
struct budget {
|
||||||
/* production by sector type */
|
/* production by sector type */
|
||||||
struct budg_item prod[SCT_TYPE_MAX + 1];
|
struct budg_item prod[SCT_TYPE_MAX + 1];
|
||||||
|
/* level production output */
|
||||||
|
float level[4];
|
||||||
/* building and maintenance */
|
/* building and maintenance */
|
||||||
struct budg_item bm[BUDG_BLD_MAX + 1];
|
struct budg_item bm[BUDG_BLD_MAX + 1];
|
||||||
/* population, taxes, military payroll, bank interest */
|
/* population, taxes, military payroll, bank interest */
|
||||||
|
@ -73,8 +75,6 @@ struct budget {
|
||||||
|
|
||||||
/* main.c */
|
/* main.c */
|
||||||
extern struct budget nat_budget[MAXNOC];
|
extern struct budget nat_budget[MAXNOC];
|
||||||
/* nat.c */
|
|
||||||
extern float levels[MAXNOC][4];
|
|
||||||
|
|
||||||
/* age.c */
|
/* age.c */
|
||||||
extern int age_people(int, int);
|
extern int age_people(int, int);
|
||||||
|
|
|
@ -73,8 +73,6 @@ static void share_incr(double[], double[]);
|
||||||
static float level_easy[4] = { 0.75, 0.75, 5.00, 5.00 };
|
static float level_easy[4] = { 0.75, 0.75, 5.00, 5.00 };
|
||||||
static float level_log[4] = { 1.75, 2.00, 4.00, 6.00 };
|
static float level_log[4] = { 1.75, 2.00, 4.00, 6.00 };
|
||||||
|
|
||||||
float levels[MAXNOC][4];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* technique to limit the sharpers who turn entire countries
|
* technique to limit the sharpers who turn entire countries
|
||||||
* into tech plants overnight...
|
* into tech plants overnight...
|
||||||
|
@ -124,6 +122,7 @@ void
|
||||||
prod_nat(int etu)
|
prod_nat(int etu)
|
||||||
{
|
{
|
||||||
struct natstr *np;
|
struct natstr *np;
|
||||||
|
float *level;
|
||||||
float hap;
|
float hap;
|
||||||
float edu;
|
float edu;
|
||||||
float hap_edu;
|
float hap_edu;
|
||||||
|
@ -143,6 +142,7 @@ prod_nat(int etu)
|
||||||
grant_btus(np, game_reset_tick(&np->nat_access));
|
grant_btus(np, game_reset_tick(&np->nat_access));
|
||||||
if (np->nat_stat < STAT_ACTIVE)
|
if (np->nat_stat < STAT_ACTIVE)
|
||||||
continue;
|
continue;
|
||||||
|
level = nat_budget[n].level;
|
||||||
/*
|
/*
|
||||||
* hap_edu: the more education people have, the
|
* hap_edu: the more education people have, the
|
||||||
* more happiness they want.
|
* more happiness they want.
|
||||||
|
@ -155,11 +155,11 @@ prod_nat(int etu)
|
||||||
* see what the total per-civilian production is
|
* see what the total per-civilian production is
|
||||||
* for this time period.
|
* for this time period.
|
||||||
*/
|
*/
|
||||||
hap = levels[n][NAT_HLEV] * hap_edu * hap_cons /
|
hap = level[NAT_HLEV] * hap_edu * hap_cons /
|
||||||
((float)pop * etu);
|
((float)pop * etu);
|
||||||
edu = levels[n][NAT_ELEV] * edu_cons / ((float)pop * etu);
|
edu = level[NAT_ELEV] * edu_cons / ((float)pop * etu);
|
||||||
wu(0, n, "%3.0f happiness, %3.0f education produced\n",
|
wu(0, n, "%3.0f happiness, %3.0f education produced\n",
|
||||||
levels[n][NAT_HLEV], levels[n][NAT_ELEV]);
|
level[NAT_HLEV], level[NAT_ELEV]);
|
||||||
hap = limit_level(hap, NAT_HLEV, 1);
|
hap = limit_level(hap, NAT_HLEV, 1);
|
||||||
edu = limit_level(edu, NAT_ELEV, 1);
|
edu = limit_level(edu, NAT_ELEV, 1);
|
||||||
/*
|
/*
|
||||||
|
@ -176,10 +176,10 @@ prod_nat(int etu)
|
||||||
/*
|
/*
|
||||||
* limit tech/research production
|
* limit tech/research production
|
||||||
*/
|
*/
|
||||||
levels[n][NAT_TLEV] =
|
level[NAT_TLEV] =
|
||||||
limit_level(levels[n][NAT_TLEV] / 1, NAT_TLEV, 0) * 1;
|
limit_level(level[NAT_TLEV] / 1, NAT_TLEV, 0) * 1;
|
||||||
levels[n][NAT_RLEV] =
|
level[NAT_RLEV] =
|
||||||
limit_level(levels[n][NAT_RLEV] / 1, NAT_RLEV, 0) * 1;
|
limit_level(level[NAT_RLEV] / 1, NAT_RLEV, 0) * 1;
|
||||||
wu(0, n, "total pop was %d, yielding %4.2f hap, %4.2f edu\n",
|
wu(0, n, "total pop was %d, yielding %4.2f hap, %4.2f edu\n",
|
||||||
pop - 1, hap, edu);
|
pop - 1, hap, edu);
|
||||||
}
|
}
|
||||||
|
@ -192,8 +192,9 @@ prod_nat(int etu)
|
||||||
for (n = 0; NULL != (np = getnatp(n)); n++) {
|
for (n = 0; NULL != (np = getnatp(n)); n++) {
|
||||||
if (np->nat_stat < STAT_ACTIVE)
|
if (np->nat_stat < STAT_ACTIVE)
|
||||||
continue;
|
continue;
|
||||||
tlev = levels[n][NAT_TLEV];
|
level = nat_budget[n].level;
|
||||||
rlev = levels[n][NAT_RLEV];
|
tlev = level[NAT_TLEV];
|
||||||
|
rlev = level[NAT_RLEV];
|
||||||
if (tech[n] != 0.0 || res[n] != 0.0) {
|
if (tech[n] != 0.0 || res[n] != 0.0) {
|
||||||
wu(0, n, "%5.4f technology (%5.4f + %5.4f), "
|
wu(0, n, "%5.4f technology (%5.4f + %5.4f), "
|
||||||
"%5.4f research (%5.4f + %5.4f) produced\n",
|
"%5.4f research (%5.4f + %5.4f) produced\n",
|
||||||
|
@ -258,8 +259,8 @@ share_incr(double res[], double tech[])
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
other_tlev = levels[j][NAT_TLEV];
|
other_tlev = nat_budget[j].level[NAT_TLEV];
|
||||||
other_rlev = levels[j][NAT_RLEV];
|
other_rlev = nat_budget[j].level[NAT_RLEV];
|
||||||
|
|
||||||
if (!opt_ALL_BLEED) {
|
if (!opt_ALL_BLEED) {
|
||||||
if (relations_with(i, j) != ALLIED)
|
if (relations_with(i, j) != ALLIED)
|
||||||
|
|
|
@ -53,8 +53,6 @@ prepare_sects(int etu)
|
||||||
struct natstr *np;
|
struct natstr *np;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
memset(levels, 0, sizeof(levels));
|
|
||||||
|
|
||||||
/* Process all the fallout. */
|
/* Process all the fallout. */
|
||||||
if (opt_FALLOUT) {
|
if (opt_FALLOUT) {
|
||||||
if (!player->simulation) {
|
if (!player->simulation) {
|
||||||
|
|
|
@ -73,6 +73,8 @@ produce(struct natstr *np, struct sctstr *sp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (product->p_level >= 0)
|
||||||
|
budget->level[product->p_level] += output;
|
||||||
budget->prod[sp->sct_type].count += ldround(output, 1);
|
budget->prod[sp->sct_type].count += ldround(output, 1);
|
||||||
budget->prod[sp->sct_type].money -= cost;
|
budget->prod[sp->sct_type].money -= cost;
|
||||||
budget->money -= cost;
|
budget->money -= cost;
|
||||||
|
@ -134,7 +136,6 @@ prod_output(struct sctstr *sp, double prodeff)
|
||||||
output = material_consume * prodeff;
|
output = material_consume * prodeff;
|
||||||
if (item == I_NONE) {
|
if (item == I_NONE) {
|
||||||
if (!player->simulation) {
|
if (!player->simulation) {
|
||||||
levels[sp->sct_own][product->p_level] += output;
|
|
||||||
wu(0, sp->sct_own, "%s (%.2f) produced in %s\n",
|
wu(0, sp->sct_own, "%s (%.2f) produced in %s\n",
|
||||||
product->p_name, output, ownxy(sp));
|
product->p_name, output, ownxy(sp));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue