]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/sdump.c
Fix trailing whitespace
[empserver] / src / lib / commands / sdump.c
index f6778b766d1ea1fb02fc1893c98d73b1c94156d9..95899e51bff9f1db27439793894895e51f88238c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
  *
  *  ---
  *
- *  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 "misc.h"
-#include "player.h"
-#include "var.h"
-#include "xy.h"
-#include "sect.h"
-#include "ship.h"
-#include "nat.h"
-#include "nsc.h"
-#include "file.h"
-#include "optlist.h"
+#include <config.h>
+
 #include "commands.h"
+#include "land.h"
+#include "optlist.h"
+#include "ship.h"
 
 int
 sdump(void)
@@ -52,10 +47,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();
 
@@ -265,18 +260,13 @@ sdump(void)
 
     nships = 0;
     np = getnatp(player->cnum);
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (!player->owner || ship.shp_own == 0)
            continue;
-       if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
-           pr("bad ship type %d (#%d)\n", ship.shp_type, ni.cur);
-           continue;
-       }
-       count_planes(&ship);
-       count_units(&ship);
        nships++;
+       npln = shp_nplane(&ship, &nch, &nxl, NULL);
        if (player->god)
-           pr("%3d ", ship.shp_own);
+           pr("%d ", ship.shp_own);
        pr("%d", ni.cur);
        n = 0;
        while (field[n]) {
@@ -291,10 +281,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);
@@ -312,25 +299,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);
@@ -366,19 +350,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:
                /*