(prexpense, budg): Printing brackets around expenses that won't

actually be paid in full didn't take the update sequence into account,
and wasn't implemented for sector building, military payroll and
capital maintenance.  Remove the feature, as fixing is hardly worth
the trouble.  This renders prexpense() trivial; inline and remove.
This commit is contained in:
Markus Armbruster 2006-06-01 17:42:59 +00:00
parent 967299a375
commit 565b6630a2
2 changed files with 14 additions and 29 deletions

View file

@ -42,9 +42,6 @@ only show you how much you'll pay for work that will actually get done
in cases where your headquarters/airports/harbors will not have enough avail
or materials to work on all units/planes/ships.
.s1
If a cost is in [brackets], then that means that you will not pay it
because you will not have enough money.
.s1
.L "Going broke"
.s1
The first thing you need to know about going broke: don't! Stuff you

View file

@ -59,7 +59,6 @@ static void calc_all(long (*p_sect)[2], int *taxes, int *Ncivs,
int *units, int *lbuild, int *nlbuild, int *lmaint,
int *planes, int *pbuild, int *npbuild, int *pmaint);
static char *dotsprintf(char *buf, char *format, int data);
static void prexpense(long cash, int *expensesp, int amount);
int
budg(void)
@ -101,42 +100,43 @@ budg(void)
pr("%ld %-7s\t", p_sect[i][0], pchr[dchr[i].d_prd].p_sname);
else
pr("\t\t");
prexpense(np->nat_money + income, &expenses, p_sect[i][1]);
pr("\t\t%8ld\n", p_sect[i][1]);
expenses += p_sect[i][1];
}
if (sbuild) {
sprintf(buf, "%d ship%s", nsbuild, splur(nsbuild));
pr("Ship building\t\t\t%-16s", buf);
prexpense(np->nat_money + income, &expenses, -sbuild);
pr("Ship building\t\t\t%-16s\t\t%8d\n", buf, -sbuild);
expenses += -sbuild;
}
if (smaint) {
sprintf(buf, "%d ship%s", ships, splur(ships));
pr("Ship maintenance\t\t%-16s", buf);
prexpense(np->nat_money + income, &expenses, -smaint);
pr("Ship maintenance\t\t%-16s\t\t%8d\n", buf, -smaint);
expenses += -smaint;
}
if (pbuild) {
sprintf(buf, "%d plane%s", npbuild, splur(npbuild));
pr("Plane building\t\t\t%-16s", buf);
prexpense(np->nat_money + income, &expenses, -pbuild);
pr("Plane building\t\t\t%-16s\t\t%8d\n", buf, -pbuild);
expenses += -pbuild;
}
if (pmaint) {
sprintf(buf, "%d plane%s", planes, splur(planes));
pr("Plane maintenance\t\t%-16s", buf);
prexpense(np->nat_money + income, &expenses, -pmaint);
pr("Plane maintenance\t\t%-16s\t\t%8d\n", buf, -pmaint);
expenses += -pmaint;
}
if (lbuild) {
sprintf(buf, "%d unit%s", nlbuild, splur(nlbuild));
pr("Unit building\t\t\t%-16s", buf);
prexpense(np->nat_money + income, &expenses, -lbuild);
pr("Unit building\t\t\t%-16s\t\t%8d\n", buf, -lbuild);
expenses += -lbuild;
}
if (lmaint) {
sprintf(buf, "%d unit%s", units, splur(units));
pr("Unit maintenance\t\t%-16s", buf);
prexpense(np->nat_money + income, &expenses, -lmaint);
pr("Unit maintenance\t\t%-16s\t\t%8d\n", buf, -lmaint);
expenses += -lmaint;
}
if (p_sect[SCT_EFFIC][1]) {
@ -266,15 +266,3 @@ dotsprintf(char *buf, char *format, int data)
sprintf(buf, format, data);
return memset(buf, '.', strspn(buf, " "));
}
static void
prexpense(long cash, int *expensesp, int amount)
{
if (cash > *expensesp) {
pr("\t\t%8d\n", amount);
*expensesp += amount;
} else {
pr("\t\t[%7d]\n", amount);
*expensesp += amount;
}
}