From 565b6630a2765fc8c5c522272aa15828e9675664 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 1 Jun 2006 17:42:59 +0000 Subject: [PATCH] (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. --- info/budget.t | 3 --- src/lib/commands/budg.c | 40 ++++++++++++++-------------------------- 2 files changed, 14 insertions(+), 29 deletions(-) diff --git a/info/budget.t b/info/budget.t index 73cc2a5b..acab8c3b 100644 --- a/info/budget.t +++ b/info/budget.t @@ -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 diff --git a/src/lib/commands/budg.c b/src/lib/commands/budg.c index 3c3fc83d..e7dd1623 100644 --- a/src/lib/commands/budg.c +++ b/src/lib/commands/budg.c @@ -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; - } -}