]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/ldump.c
Clean up superfluous includes
[empserver] / src / lib / commands / ldump.c
index d4c327772b5cd64756634e450bab0909c813c576..96e5ffd43e3920b443438a56a7472dede7a5d748 100644 (file)
@@ -1,11 +1,11 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2000, 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,
  *  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/>.
  *
  *  ---
  *
- *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- *  related information and legal notices. It is expected that any future
- *  projects/authors will amend these files as needed.
+ *  See files README, COPYING and CREDITS in the root of the source
+ *  tree for related information and legal notices.  It is expected
+ *  that future projects/authors will amend these files as needed.
  *
  *  ---
  *
  *  ldump.c: Dump land unit information
- * 
+ *
  *  Known contributors to this file:
  *     John Yockey, 1997
  *     Steve McClure, 1998
  */
 
-#include "misc.h"
-#include "player.h"
-#include "xy.h"
-#include "sect.h"
-#include "land.h"
-#include "nat.h"
-#include "nsc.h"
-#include "deity.h"
-#include "file.h"
-#include "optlist.h"
-#include "var.h"
+#include <config.h>
+
 #include "commands.h"
+#include "land.h"
 
 int
 ldump(void)
@@ -52,18 +43,17 @@ ldump(void)
     int field[128];
     struct nstr_item ni;
     struct lndstr land;
-    int vec[I_MAX + 1];
     int n, i;
     struct natstr *np;
     time_t now;
 
-    if (!snxtitem(&ni, EF_LAND, player->argp[1]))
+    if (!snxtitem(&ni, EF_LAND, player->argp[1], NULL))
        return RET_SYN;
     prdate();
     nunits = 0;
 
     if (!player->argp[2]) {
-       for (n = 1; n <= 39; n++)
+       for (n = 1; n <= 41; n++)
            field[n - 1] = n;
        field[n - 1] = 0;
     } else {
@@ -148,6 +138,10 @@ ldump(void)
                field[i++] = 38;
            } else if (!strcmp("aaf", player->argp[n])) {
                field[i++] = 39;
+           } else if (!strcmp("uw", player->argp[n])) {
+               field[i++] = 40;
+           } else if (!strcmp("civ", player->argp[n])) {
+               field[i++] = 41;
            } else {
                pr("Unrecognized field %s\n", player->argp[n]);
            }
@@ -162,7 +156,7 @@ ldump(void)
     if (player->god)
        pr("   ");
     time(&now);
-    pr("DUMP LAND UNITS %d\n", now);
+    pr("DUMP LAND UNITS %ld\n", (long)now);
     if (player->god)
        pr("own ");
     pr("id");
@@ -286,34 +280,32 @@ ldump(void)
        case 39:
            pr(" aaf");
            break;
+       case 40:
+           pr(" uw");
+           break;
+       case 41:
+           pr(" civ");
+           break;
        }
        n++;
     }
     pr("\n");
 
     np = getnatp(player->cnum);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own == 0)
            continue;
        if (!player->owner && !player->god)
            continue;
-       if (land.lnd_type < 0 || land.lnd_type > lnd_maxno) {
-           pr("bad unit type %d (#%d)\n", land.lnd_type, ni.cur);
-           continue;
-       }
-       count_land_planes(&land);
-       lnd_count_units(&land);
-
        nunits++;
        if (player->god)
-           pr("%3d ", land.lnd_own);
+           pr("%d ", land.lnd_own);
        pr("%d", ni.cur);
        n = 0;
-       getvec(VT_ITEM, vec, (s_char *)&land, EF_LAND);
        while (field[n]) {
            switch (field[n++]) {
            case 1:
-               pr(" %0.4s", lchr[(int)land.lnd_type].l_name);
+               pr(" %.4s", lchr[(int)land.lnd_type].l_name);
                break;
            case 2:
                pr(" %d", xrel(np, land.lnd_x));
@@ -322,16 +314,13 @@ ldump(void)
                pr(" %d", yrel(np, land.lnd_y));
                break;
            case 4:
-               if (land.lnd_army == ' ')
-                   pr(" ~");
-               else
-                   pr(" %c", land.lnd_army);
+               pr(" %c", land.lnd_army ? land.lnd_army : '~');
                break;
            case 5:
                pr(" %d", land.lnd_effic);
                break;
            case 6:
-               pr(" %d", lnd_getmil(&land));
+               pr(" %d", land.lnd_item[I_MILIT]);
                break;
            case 7:
                pr(" %d", land.lnd_harden);
@@ -340,13 +329,10 @@ ldump(void)
                pr(" %d", land.lnd_mobil);
                break;
            case 9:
-               pr(" %d", vec[I_FOOD]);
+               pr(" %d", land.lnd_item[I_FOOD]);
                break;
            case 10:
-               if (opt_FUEL)
-                   pr(" %d", land.lnd_fuel);
-               else
-                   pr(" 0");
+               pr(" 0");
                break;
            case 11:
                pr(" %d", land.lnd_tech);
@@ -355,13 +341,13 @@ ldump(void)
                pr(" %d", land.lnd_retreat);
                break;
            case 13:
-               pr(" %d", land.lnd_rad_max);
+               pr(" 0");
                break;
            case 14:
-               pr(" %d", land.lnd_nxlight);
+               pr(" %d", lnd_nxlight(&land));
                break;
            case 15:
-               pr(" %d", land.lnd_nland);
+               pr(" %d", lnd_nland(&land));
                break;
            case 16:
                pr(" %d", land.lnd_land);
@@ -370,70 +356,76 @@ ldump(void)
                pr(" %d", land.lnd_ship);
                break;
            case 18:
-               pr(" %d", vec[I_SHELL]);
+               pr(" %d", land.lnd_item[I_SHELL]);
                break;
            case 19:
-               pr(" %d", vec[I_GUN]);
+               pr(" %d", land.lnd_item[I_GUN]);
                break;
            case 20:
-               pr(" %d", vec[I_PETROL]);
+               pr(" %d", land.lnd_item[I_PETROL]);
                break;
            case 21:
-               pr(" %d", vec[I_IRON]);
+               pr(" %d", land.lnd_item[I_IRON]);
                break;
            case 22:
-               pr(" %d", vec[I_DUST]);
+               pr(" %d", land.lnd_item[I_DUST]);
                break;
            case 23:
-               pr(" %d", vec[I_BAR]);
+               pr(" %d", land.lnd_item[I_BAR]);
                break;
            case 24:
-               pr(" %d", vec[I_OIL]);
+               pr(" %d", land.lnd_item[I_OIL]);
                break;
            case 25:
-               pr(" %d", vec[I_LCM]);
+               pr(" %d", land.lnd_item[I_LCM]);
                break;
            case 26:
-               pr(" %d", vec[I_HCM]);
+               pr(" %d", land.lnd_item[I_HCM]);
                break;
            case 27:
-               pr(" %d", vec[I_RAD]);
+               pr(" %d", land.lnd_item[I_RAD]);
                break;
            case 28:
-               pr(" %1.2f", (float)land.lnd_att);
+               pr(" %1.2f", lnd_att(&land));
                break;
            case 29:
-               pr(" %1.2f", (float)land.lnd_def);
+               pr(" %1.2f", lnd_def(&land));
                break;
            case 30:
-               pr(" %d", land.lnd_vul);
+               pr(" %d", lnd_vul(&land));
                break;
            case 31:
-               pr(" %d", land.lnd_spd);
+               pr(" %d", lnd_spd(&land));
                break;
            case 32:
-               pr(" %d", land.lnd_vis);
+               pr(" %d", lnd_vis(&land));
                break;
            case 33:
-               pr(" %d", land.lnd_spy);
+               pr(" %d", lchr[land.lnd_type].l_spy);
                break;
            case 34:
-               pr(" %d", land.lnd_rad);
+               pr(" %d", lchr[land.lnd_type].l_rad);
                break;
            case 35:
-               pr(" %d", land.lnd_frg);
+               pr(" %d", lnd_frg(&land));
                break;
            case 36:
-               pr(" %d", land.lnd_acc);
+               pr(" %d", lnd_acc(&land));
                break;
            case 37:
-               pr(" %d", land.lnd_dam);
+               pr(" %d", lnd_dam(&land));
                break;
            case 38:
-               pr(" %d", land.lnd_ammo);
+               pr(" %d", lchr[land.lnd_type].l_ammo);
                break;
            case 39:
-               pr(" %d", land.lnd_aaf);
+               pr(" %d", lnd_aaf(&land));
+               break;
+           case 40:
+               pr(" %d", land.lnd_item[I_UW]);
+               break;
+           case 41:
+               pr(" %d", land.lnd_item[I_CIVIL]);
                break;
            }
        }