]> git.pond.sub.org Git - empserver/commitdiff
update: Lift populace() from tax into prepare_sects()
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 4 Jun 2016 15:56:41 +0000 (17:56 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 17:59:57 +0000 (19:59 +0200)
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>
include/prototypes.h
src/lib/commands/budg.c
src/lib/update/prepare.c

index 05332517ecab4b411b028d4ed809f7cd14f66674..47385c0b04d19ef43df2a03ad5b05e67f96095d3 100644 (file)
@@ -697,8 +697,7 @@ extern int prod_plane(int, int, struct bp *, int);
 extern void populace(struct natstr *, struct sctstr *, int);
 extern int total_work(int, int, int, int, int, int);
 /* prepare.c */
-extern void tax(struct sctstr *, struct natstr *, int, int *, int *,
-               int *, int *);
+extern void tax(struct sctstr *, int, int *, int *, int *, int *);
 extern int upd_slmilcosts(natid, int);
 extern void prepare_sects(int, struct bp *);
 extern int bank_income(struct sctstr *, int);
index 83efbf714ab126ace7200509875eacc43fecf982..7b205b3e0ac09e78de1d79e11ec233705e03d125 100644 (file)
@@ -197,7 +197,7 @@ calc_all(int p_sect[][2],
        bp_set_from_sect(bp, sp);
        if (sp->sct_own == player->cnum) {
            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];
            *Nuws += sp->sct_item[I_UW];
            *taxes += civ_tax + uw_tax;
index 2bb2d6289513867b218aea1a350c6fe197211624..9252dbd86ebed4a6a1d5639fe2284e38a422a2e8 100644 (file)
@@ -91,8 +91,8 @@ prepare_sects(int etu, struct bp *bp)
        if (np->nat_stat != STAT_SANCT) {
            guerrilla(sp);
            do_plague(sp, np, etu);
-           tax(sp, np, etu, &pops[sp->sct_own], &civ_tax, &uw_tax,
-               &mil_pay);
+           populace(np, sp, etu);
+           tax(sp, etu, &pops[sp->sct_own], &civ_tax, &uw_tax, &mil_pay);
            np->nat_money += civ_tax + uw_tax + mil_pay;
            if (sp->sct_type == SCT_BANK)
                np->nat_money += bank_income(sp, etu);
@@ -104,15 +104,9 @@ prepare_sects(int etu, struct bp *bp)
 }
 
 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)
 {
-    *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 *
                     etu * money_civ / 100);
     /*