update: Track oldowned civilians in nat_budget[]
Replace pops[] by nat_budget[].oldowned_civs. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
4a714a37da
commit
6eb4fd3cbf
6 changed files with 13 additions and 22 deletions
|
@ -67,11 +67,12 @@ struct budget {
|
||||||
/* treasury */
|
/* treasury */
|
||||||
int start_money; /* at beginning of update */
|
int start_money; /* at beginning of update */
|
||||||
double money; /* current */
|
double money; /* current */
|
||||||
|
/* population before growth */
|
||||||
|
int oldowned_civs;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* main.c */
|
/* main.c */
|
||||||
extern struct budget nat_budget[MAXNOC];
|
extern struct budget nat_budget[MAXNOC];
|
||||||
extern int pops[MAXNOC];
|
|
||||||
extern int tpops[MAXNOC];
|
extern int tpops[MAXNOC];
|
||||||
/* nat.c */
|
/* nat.c */
|
||||||
extern float levels[MAXNOC][4];
|
extern float levels[MAXNOC][4];
|
||||||
|
@ -127,7 +128,7 @@ extern void populace(struct sctstr *, int);
|
||||||
extern int total_work(int, int, int, int, int, int);
|
extern int total_work(int, int, int, int, int, int);
|
||||||
/* prepare.c */
|
/* prepare.c */
|
||||||
extern void prepare_sects(int);
|
extern void prepare_sects(int);
|
||||||
extern void tax(struct sctstr *, int, int *);
|
extern void tax(struct sctstr *, int);
|
||||||
extern void upd_slmilcosts(int, natid);
|
extern void upd_slmilcosts(int, natid);
|
||||||
extern void bank_income(struct sctstr *, int);
|
extern void bank_income(struct sctstr *, int);
|
||||||
extern void pay_reserve(struct natstr *, int);
|
extern void pay_reserve(struct natstr *, int);
|
||||||
|
|
|
@ -145,7 +145,6 @@ calc_all(void)
|
||||||
struct budget *budget = &nat_budget[player->cnum];
|
struct budget *budget = &nat_budget[player->cnum];
|
||||||
struct natstr *np;
|
struct natstr *np;
|
||||||
struct bp *bp;
|
struct bp *bp;
|
||||||
int pop = 0;
|
|
||||||
int n;
|
int n;
|
||||||
struct sctstr *sp;
|
struct sctstr *sp;
|
||||||
int etu = etu_per_update;
|
int etu = etu_per_update;
|
||||||
|
@ -159,12 +158,12 @@ calc_all(void)
|
||||||
bp_set_from_sect(bp, sp);
|
bp_set_from_sect(bp, sp);
|
||||||
if (sp->sct_own == player->cnum) {
|
if (sp->sct_own == player->cnum) {
|
||||||
sp->sct_updated = 0;
|
sp->sct_updated = 0;
|
||||||
tax(sp, etu, &pop);
|
tax(sp, etu);
|
||||||
if (sp->sct_type == SCT_BANK)
|
if (sp->sct_type == SCT_BANK)
|
||||||
bank_income(sp, etu);
|
bank_income(sp, etu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tpops[player->cnum] = pop;
|
tpops[player->cnum] = budget->oldowned_civs;
|
||||||
upd_slmilcosts(etu, player->cnum);
|
upd_slmilcosts(etu, player->cnum);
|
||||||
pay_reserve(np, etu);
|
pay_reserve(np, etu);
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
|
||||||
struct budget nat_budget[MAXNOC];
|
struct budget nat_budget[MAXNOC];
|
||||||
int pops[MAXNOC];
|
|
||||||
int tpops[MAXNOC];
|
int tpops[MAXNOC];
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -84,7 +83,6 @@ update_main(void)
|
||||||
* happiness, and printing out the state of the nation)
|
* happiness, and printing out the state of the nation)
|
||||||
*/
|
*/
|
||||||
memset(nat_budget, 0, sizeof(nat_budget));
|
memset(nat_budget, 0, sizeof(nat_budget));
|
||||||
memset(pops, 0, sizeof(pops));
|
|
||||||
for (n = 0; n < MAXNOC; n++) {
|
for (n = 0; n < MAXNOC; n++) {
|
||||||
if (!(np = getnatp(n)))
|
if (!(np = getnatp(n)))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -149,7 +149,7 @@ prod_nat(int etu)
|
||||||
*/
|
*/
|
||||||
hap_edu = np->nat_level[NAT_ELEV];
|
hap_edu = np->nat_level[NAT_ELEV];
|
||||||
hap_edu = 1.5 - ((hap_edu + 10.0) / (hap_edu + 20.0));
|
hap_edu = 1.5 - ((hap_edu + 10.0) / (hap_edu + 20.0));
|
||||||
pop = pops[n] + 1;
|
pop = nat_budget[n].oldowned_civs + 1;
|
||||||
/*
|
/*
|
||||||
* get per-population happiness and education
|
* get per-population happiness and education
|
||||||
* see what the total per-civilian production is
|
* see what the total per-civilian production is
|
||||||
|
|
|
@ -94,7 +94,7 @@ prepare_sects(int etu)
|
||||||
guerrilla(sp);
|
guerrilla(sp);
|
||||||
do_plague(sp, etu);
|
do_plague(sp, etu);
|
||||||
populace(sp, etu);
|
populace(sp, etu);
|
||||||
tax(sp, etu, &pops[sp->sct_own]);
|
tax(sp, etu);
|
||||||
if (sp->sct_type == SCT_BANK)
|
if (sp->sct_type == SCT_BANK)
|
||||||
bank_income(sp, etu);
|
bank_income(sp, etu);
|
||||||
}
|
}
|
||||||
|
@ -105,17 +105,16 @@ prepare_sects(int etu)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tax(struct sctstr *sp, int etu, int *pop)
|
tax(struct sctstr *sp, int etu)
|
||||||
{
|
{
|
||||||
struct budget *budget = &nat_budget[sp->sct_own];
|
struct budget *budget = &nat_budget[sp->sct_own];
|
||||||
double civ_tax, uw_tax, mil_pay;
|
double civ_tax, uw_tax, mil_pay;
|
||||||
|
|
||||||
civ_tax = sp->sct_item[I_CIVIL] * etu * money_civ * sp->sct_effic / 100;
|
civ_tax = sp->sct_item[I_CIVIL] * etu * money_civ * sp->sct_effic / 100;
|
||||||
/*
|
if (sp->sct_own == sp->sct_oldown)
|
||||||
* captured civs only pay 1/4 taxes
|
budget->oldowned_civs += sp->sct_item[I_CIVIL];
|
||||||
*/
|
else
|
||||||
if (sp->sct_own != sp->sct_oldown)
|
civ_tax /= 4; /* captured civs pay less */
|
||||||
civ_tax /= 4;
|
|
||||||
budget->civ.count += sp->sct_item[I_CIVIL];
|
budget->civ.count += sp->sct_item[I_CIVIL];
|
||||||
budget->civ.money += civ_tax;
|
budget->civ.money += civ_tax;
|
||||||
budget->money += civ_tax;
|
budget->money += civ_tax;
|
||||||
|
@ -129,12 +128,6 @@ tax(struct sctstr *sp, int etu, int *pop)
|
||||||
budget->mil.count += sp->sct_item[I_MILIT];
|
budget->mil.count += sp->sct_item[I_MILIT];
|
||||||
budget->mil.money += mil_pay;
|
budget->mil.money += mil_pay;
|
||||||
budget->money += mil_pay;
|
budget->money += mil_pay;
|
||||||
|
|
||||||
/*
|
|
||||||
* only non-captured civs add to census for nation
|
|
||||||
*/
|
|
||||||
if (sp->sct_oldown == sp->sct_own)
|
|
||||||
*pop += sp->sct_item[I_CIVIL];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -224,7 +224,7 @@ upd_ship(struct shpstr *sp, int etus, struct bp *bp, int build)
|
||||||
sp->shp_pstage = pstage;
|
sp->shp_pstage = pstage;
|
||||||
sp->shp_ptime = ptime;
|
sp->shp_ptime = ptime;
|
||||||
}
|
}
|
||||||
pops[sp->shp_own] += sp->shp_item[I_CIVIL];
|
budget->oldowned_civs += sp->shp_item[I_CIVIL];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue