]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/sdump.c
Update copyright notice
[empserver] / src / lib / commands / sdump.c
index ad576a40be9f43f2d5d3e684071564572b6b798b..f9482557fd9d29ff198ee40324f76b77f42060ae 100644 (file)
@@ -1,11 +1,11 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2005, Dave Pare, Jeff Bailey, Thomas Ruschak,
- *                           Ken Stevens, Steve McClure
+ *  Copyright (C) 1986-2021, 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.
  *
  *  ---
  *
  *  sdump.c: Dump ship information
- * 
+ *
  *  Known contributors to this file:
  *     John Yockey, 1997
  *     Steve McClure, 1998
 
 #include <config.h>
 
-#include "misc.h"
-#include "player.h"
-#include "xy.h"
-#include "sect.h"
-#include "ship.h"
-#include "nat.h"
-#include "nsc.h"
-#include "file.h"
-#include "optlist.h"
 #include "commands.h"
+#include "ship.h"
 
 int
 sdump(void)
@@ -53,10 +44,10 @@ sdump(void)
     struct shpstr ship;
     int field[128];
     struct natstr *np;
-    int n, i;
+    int n, i, npln, nch, nxl;
     time_t now;
 
-    if (!snxtitem(&ni, EF_SHIP, player->argp[1]))
+    if (!snxtitem(&ni, EF_SHIP, player->argp[1], NULL))
        return RET_SYN;
     prdate();
 
@@ -269,9 +260,8 @@ sdump(void)
     while (nxtitem(&ni, &ship)) {
        if (!player->owner || ship.shp_own == 0)
            continue;
-       count_planes(&ship);
-       count_units(&ship);
        nships++;
+       npln = shp_nplane(&ship, &nch, &nxl, NULL);
        if (player->god)
            pr("%d ", ship.shp_own);
        pr("%d", ni.cur);
@@ -288,10 +278,7 @@ sdump(void)
                pr(" %d", yrel(np, ship.shp_y));
                break;
            case 4:
-               if (ship.shp_fleet == ' ')
-                   pr(" ~");
-               else
-                   pr(" %c", ship.shp_fleet);
+               pr(" %c", ship.shp_fleet ? ship.shp_fleet : '~');
                break;
            case 5:
                pr(" %d", ship.shp_effic);
@@ -309,25 +296,22 @@ sdump(void)
                pr(" %d", ship.shp_item[I_FOOD]);
                break;
            case 10:
-               pr(" %d", ship.shp_nplane);
+               pr(" %d", npln - nch - nxl);
                break;
            case 11:
-               pr(" %d", ship.shp_nchoppers);
+               pr(" %d", nch);
                break;
            case 12:
-               pr(" %d", ship.shp_nxlight);
+               pr(" %d", nxl);
                break;
            case 13:
-               pr(" %d", ship.shp_nland);
+               pr(" %d", shp_nland(&ship));
                break;
            case 14:
                pr(" %d", ship.shp_mobil);
                break;
            case 15:
-               if (opt_FUEL)
-                   pr(" %d", ship.shp_fuel);
-               else
-                   pr(" 0");
+               pr(" 0");
                break;
            case 16:
                pr(" %d", ship.shp_tech);
@@ -363,19 +347,19 @@ sdump(void)
                pr(" %d", ship.shp_item[I_RAD]);
                break;
            case 27:
-               pr(" %d", ship.shp_armor);
+               pr(" %d", shp_armor(&ship));
                break;
            case 28:
-               pr(" %d", ship.shp_speed);
+               pr(" %d", shp_speed(&ship));
                break;
            case 29:
-               pr(" %d", ship.shp_visib);
+               pr(" %d", shp_visib(&ship));
                break;
            case 30:
-               pr(" %d", ship.shp_frnge);
+               pr(" %d", shp_frnge(&ship));
                break;
            case 31:
-               pr(" %d", ship.shp_glim);
+               pr(" %d", shp_glim(&ship));
                break;
            case 32:
                /*