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:
57 if (!snxtitem(&ni, EF_SHIP, player->argp[1]))
61 if (!player->argp[2]) {
62 for (n = 1; n <= 34; n++)
68 while (player->argp[n]) {
69 if (!strcmp("type", player->argp[n])) {
71 } else if (!strcmp("x", player->argp[n])) {
73 } else if (!strcmp("y", player->argp[n])) {
75 } else if (!strcmp("flt", player->argp[n])) {
77 } else if (!strcmp("eff", player->argp[n])) {
79 } else if (!strcmp("civ", player->argp[n])) {
81 } else if (!strcmp("mil", player->argp[n])) {
83 } else if (!strcmp("uw", player->argp[n])) {
85 } else if (!strcmp("food", player->argp[n])) {
87 } else if (!strcmp("pln", player->argp[n])) {
89 } else if (!strcmp("he", player->argp[n])) {
91 } else if (!strcmp("xl", player->argp[n])) {
93 } else if (!strcmp("land", player->argp[n])) {
95 } else if (!strcmp("mob", player->argp[n])) {
97 } else if (!strcmp("fuel", player->argp[n])) {
99 } else if (!strcmp("tech", player->argp[n])) {
101 } else if (!strcmp("shell", player->argp[n])) {
103 } else if (!strcmp("gun", player->argp[n])) {
105 } else if (!strcmp("petrol", player->argp[n])) {
107 } else if (!strcmp("iron", player->argp[n])) {
109 } else if (!strcmp("dust", player->argp[n])) {
111 } else if (!strcmp("bar", player->argp[n])) {
113 } else if (!strcmp("oil", player->argp[n])) {
115 } else if (!strcmp("lcm", player->argp[n])) {
117 } else if (!strcmp("hcm", player->argp[n])) {
119 } else if (!strcmp("rad", player->argp[n])) {
121 } else if (!strcmp("def", player->argp[n])) {
123 } else if (!strcmp("spd", player->argp[n])) {
125 } else if (!strcmp("vis", player->argp[n])) {
127 } else if (!strcmp("rng", player->argp[n])) {
129 } else if (!strcmp("fir", player->argp[n])) {
131 } else if (!strcmp("origx", player->argp[n])) {
133 } else if (!strcmp("origy", player->argp[n])) {
135 } else if (!strcmp("name", player->argp[n])) {
138 pr("Unrecognized field %s\n", player->argp[n]);
141 pr("Too many fields\n");
151 pr("DUMP SHIPS %ld\n", (long)now);
266 np = getnatp(player->cnum);
267 while (nxtitem(&ni, (s_char *)&ship)) {
268 if (!player->owner || ship.shp_own == 0)
270 if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
271 pr("bad ship type %d (#%d)\n", ship.shp_type, ni.cur);
278 pr("%d ", ship.shp_own);
282 switch (field[n++]) {
284 pr(" %.4s", mchr[(int)ship.shp_type].m_name);
287 pr(" %d", xrel(np, ship.shp_x));
290 pr(" %d", yrel(np, ship.shp_y));
293 if (ship.shp_fleet == ' ')
296 pr(" %c", ship.shp_fleet);
299 pr(" %d", ship.shp_effic);
302 pr(" %d", ship.shp_item[I_CIVIL]);
305 pr(" %d", ship.shp_item[I_MILIT]);
308 pr(" %d", ship.shp_item[I_UW]);
311 pr(" %d", ship.shp_item[I_FOOD]);
314 pr(" %d", ship.shp_nplane);
317 pr(" %d", ship.shp_nchoppers);
320 pr(" %d", ship.shp_nxlight);
323 pr(" %d", ship.shp_nland);
326 pr(" %d", ship.shp_mobil);
330 pr(" %d", ship.shp_fuel);
335 pr(" %d", ship.shp_tech);
338 pr(" %d", ship.shp_item[I_SHELL]);
341 pr(" %d", ship.shp_item[I_GUN]);
344 pr(" %d", ship.shp_item[I_PETROL]);
347 pr(" %d", ship.shp_item[I_IRON]);
350 pr(" %d", ship.shp_item[I_DUST]);
353 pr(" %d", ship.shp_item[I_BAR]);
356 pr(" %d", ship.shp_item[I_OIL]);
359 pr(" %d", ship.shp_item[I_LCM]);
362 pr(" %d", ship.shp_item[I_HCM]);
365 pr(" %d", ship.shp_item[I_RAD]);
368 pr(" %d", ship.shp_armor);
371 pr(" %d", ship.shp_speed);
374 pr(" %d", ship.shp_visib);
377 pr(" %d", ship.shp_frnge);
380 pr(" %d", ship.shp_glim);
384 * Disclosing construction site allows pirates to find
385 * harbors. Disclose it only to the original owner
386 * and to deities. Else dump illegal coordinates
389 if (ship.shp_own == ship.shp_orig_own || player->god)
390 pr(" %d", xrel(np, ship.shp_orig_x));
396 if (ship.shp_own == ship.shp_orig_own || player->god)
397 pr(" %d", yrel(np, ship.shp_orig_y));
402 pr(" %c%s%c", '"', ship.shp_name, '"');
410 pr("%s: No ship(s)\n", player->argp[1]);
412 pr("%s: No ship(s)\n", "");
415 pr("%d ship%s\n", nships, splur(nships));