]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/sdump.c
Update copyright notice
[empserver] / src / lib / commands / sdump.c
index d18bd1030a00fcaf049d17b796075e60dcf5bbeb..f9482557fd9d29ff198ee40324f76b77f42060ae 100644 (file)
@@ -1,11 +1,11 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2007, 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,
@@ -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/>.
  *
  *  ---
  *
@@ -26,7 +25,7 @@
  *  ---
  *
  *  sdump.c: Dump ship information
- * 
+ *
  *  Known contributors to this file:
  *     John Yockey, 1997
  *     Steve McClure, 1998
@@ -35,8 +34,6 @@
 #include <config.h>
 
 #include "commands.h"
-#include "land.h"
-#include "optlist.h"
 #include "ship.h"
 
 int
@@ -47,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();
 
@@ -263,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);
@@ -300,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);
@@ -354,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:
                /*