]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/pdump.c
Update copyright notice
[empserver] / src / lib / commands / pdump.c
index 3cd8a9223f9391e84f5fb4627c3282a05d33d292..4de8d5df447e240bf200165430304d68b13ce77c 100644 (file)
@@ -1,11 +1,11 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2004, Dave Pare, Jeff Bailey, Thomas Ruschak,
- *                           Ken Stevens, Steve McClure
+ *  Copyright (C) 1986-2012, 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.
  *
  *  ---
  *
  *  pdump.c: Dump plane 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 "plane.h"
-#include "nsc.h"
-#include "nuke.h"
-#include "file.h"
-#include "nat.h"
-#include "optlist.h"
+#include <config.h>
+
 #include "commands.h"
+#include "nuke.h"
+#include "plane.h"
 
 int
 pdump(void)
@@ -50,12 +43,13 @@ pdump(void)
     int nplanes;
     struct nstr_item np;
     struct plnstr plane;
+    struct nukstr nuke;
     int field[128];
     struct natstr *natp;
     int n, i;
     time_t now;
 
-    if (!snxtitem(&np, EF_PLANE, player->argp[1]))
+    if (!snxtitem(&np, EF_PLANE, player->argp[1], NULL))
        return RET_SYN;
     prdate();
 
@@ -201,7 +195,7 @@ pdump(void)
 
     nplanes = 0;
     natp = getnatp(player->cnum);
-    while (nxtitem(&np, (s_char *)&plane)) {
+    while (nxtitem(&np, &plane)) {
        if (!player->owner || plane.pln_own == 0)
            continue;
        nplanes++;
@@ -221,10 +215,7 @@ pdump(void)
                pr(" %d", yrel(natp, plane.pln_y));
                break;
            case 4:
-               if (plane.pln_wing == ' ')
-                   pr(" ~");
-               else
-                   pr(" %c", plane.pln_wing);
+               pr(" %c", plane.pln_wing ? plane.pln_wing : '~');
                break;
            case 5:
                pr(" %d", plane.pln_effic);
@@ -236,25 +227,25 @@ pdump(void)
                pr(" %d", plane.pln_tech);
                break;
            case 8:
-               pr(" %d", plane.pln_att);
+               pr(" %d", pln_att(&plane));
                break;
            case 9:
-               pr(" %d", plane.pln_def);
+               pr(" %d", pln_def(&plane));
                break;
            case 10:
-               pr(" %d", plane.pln_acc);
+               pr(" %d", pln_acc(&plane));
                break;
            case 11:
                pr(" %d", plane.pln_range);
                break;
            case 12:
-               pr(" %d", plane.pln_range_max);
+               pr(" %d", pln_range_max(&plane));
                break;
            case 13:
-               pr(" %d", plane.pln_load);
+               pr(" %d", pln_load(&plane));
                break;
            case 14:
-               pr(" %d", plane.pln_fuel);
+               pr(" %d", plchr[(int)plane.pln_type].pl_fuel);
                break;
            case 15:
                pr(" %d", plane.pln_harden);
@@ -266,31 +257,20 @@ pdump(void)
                pr(" %d", plane.pln_land);
                break;
            case 18:
-               if ((plchr[(int)plane.pln_type].pl_flags & (P_O | P_M)) ==
-                   P_O) {
-                   pr(" %c",
-                      (plane.pln_flags & PLN_LAUNCHED) ? 'Y' : 'N');
-               } else
-                   pr(" N");
+               pr(pln_is_in_orbit(&plane) ? " Y" : " N");
                break;
            case 19:
-               if ((plchr[(int)plane.pln_type].pl_flags & (P_O | P_M)) ==
-                   P_O) {
-                   pr(" %c",
-                      opt_ORBIT ? (plane.
-                                   pln_flags & PLN_SYNCHRONOUS) ? 'Y' :
-                      'N' : 'N');
-               } else
-                   pr(" N");
+               pr(pln_is_in_orbit(&plane)
+                  && (plane.pln_flags & PLN_SYNCHRONOUS)
+                  ? " Y" : " N");
                break;
            case 20:
-               if (plane.pln_nuketype != -1) {
-                   pr(" %.5s", nchr[(int)plane.pln_nuketype].n_name);
+               if (getnuke(nuk_on_plane(&plane), &nuke)) {
+                   pr(" %.5s", nchr[nuke.nuk_type].n_name);
                    break;
                } else
                    pr(" N/A");
                break;
-
            case 21:
                pr(" %c", plane.pln_flags & PLN_AIRBURST ? 'A' : 'G');
                break;