update: Lift populace() from tax into prepare_sects()
This way, tax() is more focused, and populace() doesn't need to be guarded with !player->simulation. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
a6a2e0b5da
commit
1e8d290e57
3 changed files with 5 additions and 12 deletions
|
@ -697,8 +697,7 @@ extern int prod_plane(int, int, struct bp *, int);
|
||||||
extern void populace(struct natstr *, struct sctstr *, int);
|
extern void populace(struct natstr *, 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 tax(struct sctstr *, struct natstr *, int, int *, int *,
|
extern void tax(struct sctstr *, int, int *, int *, int *, int *);
|
||||||
int *, int *);
|
|
||||||
extern int upd_slmilcosts(natid, int);
|
extern int upd_slmilcosts(natid, int);
|
||||||
extern void prepare_sects(int, struct bp *);
|
extern void prepare_sects(int, struct bp *);
|
||||||
extern int bank_income(struct sctstr *, int);
|
extern int bank_income(struct sctstr *, int);
|
||||||
|
|
|
@ -197,7 +197,7 @@ calc_all(int p_sect[][2],
|
||||||
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, np, etu, &pop, &civ_tax, &uw_tax, &mil_pay);
|
tax(sp, etu, &pop, &civ_tax, &uw_tax, &mil_pay);
|
||||||
*Ncivs += sp->sct_item[I_CIVIL];
|
*Ncivs += sp->sct_item[I_CIVIL];
|
||||||
*Nuws += sp->sct_item[I_UW];
|
*Nuws += sp->sct_item[I_UW];
|
||||||
*taxes += civ_tax + uw_tax;
|
*taxes += civ_tax + uw_tax;
|
||||||
|
|
|
@ -91,8 +91,8 @@ prepare_sects(int etu, struct bp *bp)
|
||||||
if (np->nat_stat != STAT_SANCT) {
|
if (np->nat_stat != STAT_SANCT) {
|
||||||
guerrilla(sp);
|
guerrilla(sp);
|
||||||
do_plague(sp, np, etu);
|
do_plague(sp, np, etu);
|
||||||
tax(sp, np, etu, &pops[sp->sct_own], &civ_tax, &uw_tax,
|
populace(np, sp, etu);
|
||||||
&mil_pay);
|
tax(sp, etu, &pops[sp->sct_own], &civ_tax, &uw_tax, &mil_pay);
|
||||||
np->nat_money += civ_tax + uw_tax + mil_pay;
|
np->nat_money += civ_tax + uw_tax + mil_pay;
|
||||||
if (sp->sct_type == SCT_BANK)
|
if (sp->sct_type == SCT_BANK)
|
||||||
np->nat_money += bank_income(sp, etu);
|
np->nat_money += bank_income(sp, etu);
|
||||||
|
@ -104,15 +104,9 @@ prepare_sects(int etu, struct bp *bp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tax(struct sctstr *sp, struct natstr *np, int etu, int *pop, int *civ_tax,
|
tax(struct sctstr *sp, int etu, int *pop, int *civ_tax,
|
||||||
int *uw_tax, int *mil_pay)
|
int *uw_tax, int *mil_pay)
|
||||||
{
|
{
|
||||||
*civ_tax = 0;
|
|
||||||
*uw_tax = 0;
|
|
||||||
*mil_pay = 0;
|
|
||||||
|
|
||||||
if (!player->simulation)
|
|
||||||
populace(np, sp, etu);
|
|
||||||
*civ_tax = (int)(0.5 + sp->sct_item[I_CIVIL] * sp->sct_effic *
|
*civ_tax = (int)(0.5 + sp->sct_item[I_CIVIL] * sp->sct_effic *
|
||||||
etu * money_civ / 100);
|
etu * money_civ / 100);
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue