/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2005, 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 "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)
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();
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("%d ", ship.shp_own);
pr("%d", ni.cur);
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);
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);
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:
/*