]> git.pond.sub.org Git - empserver/commitdiff
(prexpense, budg): Printing brackets around expenses that won't
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 1 Jun 2006 17:42:59 +0000 (17:42 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 1 Jun 2006 17:42:59 +0000 (17:42 +0000)
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
src/lib/commands/budg.c

index 73cc2a5b364466555e4ebff033c5f495331c9d94..acab8c3bb9d191d85b0743216b83b6d0a109e376 100644 (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
index 3c3fc83dc8618538a8311df73c83ff89c8985b53..e7dd1623d5d7b3ccd365786f25c368871c637f7f 100644 (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;
-    }
-}