]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/budg.c
Clean up superfluous includes
[empserver] / src / lib / commands / budg.c
index 3c8f36df4b55cc5605f0e3a9bc7bd5bc4078c8cd..63fe0c7dfa58fca4e12f5643c9b7ffb5f7b40ba4 100644 (file)
@@ -1,11 +1,11 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
- *                           Ken Stevens, Steve McClure
+ *  Copyright (C) 1986-2011, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *                Ken Stevens, Steve McClure, Markus Armbruster
  *
- *  This program is free software; you can redistribute it and/or modify
+ *  Empire is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
+ *  the Free Software Foundation, either version 3 of the License, or
  *  (at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
@@ -14,8 +14,7 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  *  ---
  *
  *  ---
  *
  *  budg.c: Calculate production levels, prioritize
- * 
+ *
  *  Known contributors to this file:
  *     Thomas Ruschak, 1992
  *     Ville Virrankoski, 1995
  *     Steve McClure, 1997-2000
- *     Markus Armbruster, 2004-2006
+ *     Markus Armbruster, 2004-2009
  */
 
 #include <config.h>
 #include "budg.h"
 #include "commands.h"
 #include "item.h"
-#include "land.h"
 #include "optlist.h"
-#include "plane.h"
 #include "product.h"
-#include "ship.h"
 
 static void calc_all(long (*p_sect)[2], int *taxes, int *Ncivs,
                     int *Nuws, int *bars, int *Nbars, int *mil,
@@ -57,7 +53,7 @@ int
 budg(void)
 {
     int i;
-    long p_sect[SCT_TYPE_MAX+2][2];
+    long p_sect[SCT_BUDG_MAX+1][2];
     int taxes, Ncivs, Nuws, bars, Nbars, mil;
     int ships, sbuild, nsbuild, smaint;
     int units, lbuild, nlbuild, lmaint;
@@ -84,7 +80,7 @@ budg(void)
     expenses = 0;
     pr("Sector Type\t\t\tProduction\t\t\t    Cost\n");
     for (i = 0; i <= SCT_TYPE_MAX; i++) {
-       if (!p_sect[i][1] || i == SCT_CAPIT)
+       if (!p_sect[i][1])
            continue;
        pr("%-17s\t\t", dchr[i].d_name);
        if (i == SCT_ENLIST)
@@ -133,26 +129,25 @@ budg(void)
     }
 
     if (p_sect[SCT_EFFIC][1]) {
-       pr("Sector building\t\t\t\t%8ld sct(s)\t\t%8ld\n",
-          p_sect[SCT_EFFIC][0], p_sect[SCT_EFFIC][1]);
+       sprintf(buf, "%ld sector%s",
+               p_sect[SCT_EFFIC][0], splur(p_sect[SCT_EFFIC][0]));
+       pr("Sector building\t\t\t%-16s\t\t%8ld\n",
+          buf, p_sect[SCT_EFFIC][1]);
        expenses += p_sect[SCT_EFFIC][1];
     }
+    if (p_sect[SCT_MAINT][0]) {
+       sprintf(buf, "%ld sector%s",
+               p_sect[SCT_MAINT][0], splur(p_sect[SCT_MAINT][0]));
+       pr("Sector maintenance\t\t%-16s\t\t%8ld\n",
+          buf, p_sect[SCT_MAINT][1]);
+       expenses += p_sect[SCT_MAINT][1];
+    }
     if (mil) {
        n = (mil - np->nat_reserve * money_res * etu) / (etu * money_mil);
        sprintf(in, "%d mil, %d res", n, (int)np->nat_reserve);
        pr("Military payroll\t\t%-32s%8d\n", in, -mil);
        expenses -= mil;
     }
-    if (p_sect[SCT_CAPIT][0]) {
-       pr("%c%s maintenance\t\t",
-          toupper(dchr[SCT_CAPIT].d_name[0]),
-          dchr[SCT_CAPIT].d_name + 1);
-       n = p_sect[SCT_CAPIT][0];
-       sprintf(in, "%d %s", n, dchr[SCT_CAPIT].d_name);
-       plurize(in, sizeof(in), n);
-       pr("%-32s%8ld\n", in, p_sect[SCT_CAPIT][1]);
-       expenses += p_sect[SCT_CAPIT][1];
-    }
     pr("Total expenses%s\n", dotsprintf(buf, "%58d", expenses));
     if (taxes) {
        sprintf(in, "%d civ%s, %d uw%s",
@@ -190,12 +185,12 @@ calc_all(long p_sect[][2],
     struct sctstr *sp;
     int etu = etu_per_update;
 
-    memset(p_sect, 0, sizeof(**p_sect) * (SCT_TYPE_MAX+2) * 2);
+    memset(p_sect, 0, sizeof(**p_sect) * (SCT_BUDG_MAX+1) * 2);
     *taxes = *Ncivs = *Nuws = *bars = *Nbars = *mil = 0;
     *ships = *sbuild = *nsbuild = *smaint = 0;
     *units = *lbuild = *nlbuild = *lmaint = 0;
     *planes = *pbuild = *npbuild = *pmaint = 0;
-    
+
     np = getnatp(player->cnum);
     bp = bp_alloc();
     for (n = 0; NULL != (sp = getsectid(n)); n++) {