2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2004, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
23 * related information and legal notices. It is expected that any future
24 * projects/authors will amend these files as needed.
28 * sdump.c: Dump ship information
30 * Known contributors to this file:
58 if (!snxtitem(&ni, EF_SHIP, player->argp[1]))
62 if (!player->argp[2]) {
63 for (n = 1; n <= 34; n++)
69 while (player->argp[n]) {
70 if (!strcmp("type", player->argp[n])) {
72 } else if (!strcmp("x", player->argp[n])) {
74 } else if (!strcmp("y", player->argp[n])) {
76 } else if (!strcmp("flt", player->argp[n])) {
78 } else if (!strcmp("eff", player->argp[n])) {
80 } else if (!strcmp("civ", player->argp[n])) {
82 } else if (!strcmp("mil", player->argp[n])) {
84 } else if (!strcmp("uw", player->argp[n])) {
86 } else if (!strcmp("food", player->argp[n])) {
88 } else if (!strcmp("pln", player->argp[n])) {
90 } else if (!strcmp("he", player->argp[n])) {
92 } else if (!strcmp("xl", player->argp[n])) {
94 } else if (!strcmp("land", player->argp[n])) {
96 } else if (!strcmp("mob", player->argp[n])) {
98 } else if (!strcmp("fuel", player->argp[n])) {
100 } else if (!strcmp("tech", player->argp[n])) {
102 } else if (!strcmp("shell", player->argp[n])) {
104 } else if (!strcmp("gun", player->argp[n])) {
106 } else if (!strcmp("petrol", player->argp[n])) {
108 } else if (!strcmp("iron", player->argp[n])) {
110 } else if (!strcmp("dust", player->argp[n])) {
112 } else if (!strcmp("bar", player->argp[n])) {
114 } else if (!strcmp("oil", player->argp[n])) {
116 } else if (!strcmp("lcm", player->argp[n])) {
118 } else if (!strcmp("hcm", player->argp[n])) {
120 } else if (!strcmp("rad", player->argp[n])) {
122 } else if (!strcmp("def", player->argp[n])) {
124 } else if (!strcmp("spd", player->argp[n])) {
126 } else if (!strcmp("vis", player->argp[n])) {
128 } else if (!strcmp("rng", player->argp[n])) {
130 } else if (!strcmp("fir", player->argp[n])) {
132 } else if (!strcmp("origx", player->argp[n])) {
134 } else if (!strcmp("origy", player->argp[n])) {
136 } else if (!strcmp("name", player->argp[n])) {
139 pr("Unrecognized field %s\n", player->argp[n]);
142 pr("Too many fields\n");
152 pr("DUMP SHIPS %ld\n", (long)now);
267 np = getnatp(player->cnum);
268 while (nxtitem(&ni, (s_char *)&ship)) {
269 if (!player->owner || ship.shp_own == 0)
271 if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
272 pr("bad ship type %d (#%d)\n", ship.shp_type, ni.cur);
279 pr("%d ", ship.shp_own);
283 switch (field[n++]) {
285 pr(" %.4s", mchr[(int)ship.shp_type].m_name);
288 pr(" %d", xrel(np, ship.shp_x));
291 pr(" %d", yrel(np, ship.shp_y));
294 if (ship.shp_fleet == ' ')
297 pr(" %c", ship.shp_fleet);
300 pr(" %d", ship.shp_effic);
303 pr(" %d", ship.shp_item[I_CIVIL]);
306 pr(" %d", ship.shp_item[I_MILIT]);
309 pr(" %d", ship.shp_item[I_UW]);
312 pr(" %d", ship.shp_item[I_FOOD]);
315 pr(" %d", ship.shp_nplane);
318 pr(" %d", ship.shp_nchoppers);
321 pr(" %d", ship.shp_nxlight);
324 pr(" %d", ship.shp_nland);
327 pr(" %d", ship.shp_mobil);
331 pr(" %d", ship.shp_fuel);
336 pr(" %d", ship.shp_tech);
339 pr(" %d", ship.shp_item[I_SHELL]);
342 pr(" %d", ship.shp_item[I_GUN]);
345 pr(" %d", ship.shp_item[I_PETROL]);
348 pr(" %d", ship.shp_item[I_IRON]);
351 pr(" %d", ship.shp_item[I_DUST]);
354 pr(" %d", ship.shp_item[I_BAR]);
357 pr(" %d", ship.shp_item[I_OIL]);
360 pr(" %d", ship.shp_item[I_LCM]);
363 pr(" %d", ship.shp_item[I_HCM]);
366 pr(" %d", ship.shp_item[I_RAD]);
369 pr(" %d", ship.shp_armor);
372 pr(" %d", ship.shp_speed);
375 pr(" %d", ship.shp_visib);
378 pr(" %d", ship.shp_frnge);
381 pr(" %d", ship.shp_glim);
385 * Disclosing construction site allows pirates to find
386 * harbors. Disclose it only to the original owner
387 * and to deities. Else dump illegal coordinates
390 if (ship.shp_own == ship.shp_orig_own || player->god)
391 pr(" %d", xrel(np, ship.shp_orig_x));
397 if (ship.shp_own == ship.shp_orig_own || player->god)
398 pr(" %d", yrel(np, ship.shp_orig_y));
403 pr(" %c%s%c", '"', ship.shp_name, '"');
411 pr("%s: No ship(s)\n", player->argp[1]);
413 pr("%s: No ship(s)\n", "");
416 pr("%d ship%s\n", nships, splur(nships));