2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2021, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure, Markus Armbruster
6 * Empire 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 3 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, see <http://www.gnu.org/licenses/>.
21 * See files README, COPYING and CREDITS in the root of the source
22 * tree for related information and legal notices. It is expected
23 * that future projects/authors will amend these files as needed.
27 * sdump.c: Dump ship information
29 * Known contributors to this file:
47 int n, i, npln, nch, nxl;
50 if (!snxtitem(&ni, EF_SHIP, player->argp[1], NULL))
54 if (!player->argp[2]) {
55 for (n = 1; n <= 34; n++)
61 while (player->argp[n]) {
62 if (!strcmp("type", player->argp[n])) {
64 } else if (!strcmp("x", player->argp[n])) {
66 } else if (!strcmp("y", player->argp[n])) {
68 } else if (!strcmp("flt", player->argp[n])) {
70 } else if (!strcmp("eff", player->argp[n])) {
72 } else if (!strcmp("civ", player->argp[n])) {
74 } else if (!strcmp("mil", player->argp[n])) {
76 } else if (!strcmp("uw", player->argp[n])) {
78 } else if (!strcmp("food", player->argp[n])) {
80 } else if (!strcmp("pln", player->argp[n])) {
82 } else if (!strcmp("he", player->argp[n])) {
84 } else if (!strcmp("xl", player->argp[n])) {
86 } else if (!strcmp("land", player->argp[n])) {
88 } else if (!strcmp("mob", player->argp[n])) {
90 } else if (!strcmp("fuel", player->argp[n])) {
92 } else if (!strcmp("tech", player->argp[n])) {
94 } else if (!strcmp("shell", player->argp[n])) {
96 } else if (!strcmp("gun", player->argp[n])) {
98 } else if (!strcmp("petrol", player->argp[n])) {
100 } else if (!strcmp("iron", player->argp[n])) {
102 } else if (!strcmp("dust", player->argp[n])) {
104 } else if (!strcmp("bar", player->argp[n])) {
106 } else if (!strcmp("oil", player->argp[n])) {
108 } else if (!strcmp("lcm", player->argp[n])) {
110 } else if (!strcmp("hcm", player->argp[n])) {
112 } else if (!strcmp("rad", player->argp[n])) {
114 } else if (!strcmp("def", player->argp[n])) {
116 } else if (!strcmp("spd", player->argp[n])) {
118 } else if (!strcmp("vis", player->argp[n])) {
120 } else if (!strcmp("rng", player->argp[n])) {
122 } else if (!strcmp("fir", player->argp[n])) {
124 } else if (!strcmp("origx", player->argp[n])) {
126 } else if (!strcmp("origy", player->argp[n])) {
128 } else if (!strcmp("name", player->argp[n])) {
131 pr("Unrecognized field %s\n", player->argp[n]);
134 pr("Too many fields\n");
144 pr("DUMP SHIPS %ld\n", (long)now);
259 np = getnatp(player->cnum);
260 while (nxtitem(&ni, &ship)) {
261 if (!player->owner || ship.shp_own == 0)
264 npln = shp_nplane(&ship, &nch, &nxl, NULL);
266 pr("%d ", ship.shp_own);
270 switch (field[n++]) {
272 pr(" %.4s", mchr[(int)ship.shp_type].m_name);
275 pr(" %d", xrel(np, ship.shp_x));
278 pr(" %d", yrel(np, ship.shp_y));
281 pr(" %c", ship.shp_fleet ? ship.shp_fleet : '~');
284 pr(" %d", ship.shp_effic);
287 pr(" %d", ship.shp_item[I_CIVIL]);
290 pr(" %d", ship.shp_item[I_MILIT]);
293 pr(" %d", ship.shp_item[I_UW]);
296 pr(" %d", ship.shp_item[I_FOOD]);
299 pr(" %d", npln - nch - nxl);
308 pr(" %d", shp_nland(&ship));
311 pr(" %d", ship.shp_mobil);
317 pr(" %d", ship.shp_tech);
320 pr(" %d", ship.shp_item[I_SHELL]);
323 pr(" %d", ship.shp_item[I_GUN]);
326 pr(" %d", ship.shp_item[I_PETROL]);
329 pr(" %d", ship.shp_item[I_IRON]);
332 pr(" %d", ship.shp_item[I_DUST]);
335 pr(" %d", ship.shp_item[I_BAR]);
338 pr(" %d", ship.shp_item[I_OIL]);
341 pr(" %d", ship.shp_item[I_LCM]);
344 pr(" %d", ship.shp_item[I_HCM]);
347 pr(" %d", ship.shp_item[I_RAD]);
350 pr(" %d", shp_armor(&ship));
353 pr(" %d", shp_speed(&ship));
356 pr(" %d", shp_visib(&ship));
359 pr(" %d", shp_frnge(&ship));
362 pr(" %d", shp_glim(&ship));
366 * Disclosing construction site allows pirates to find
367 * harbors. Disclose it only to the original owner
368 * and to deities. Else dump illegal coordinates
371 if (ship.shp_own == ship.shp_orig_own || player->god)
372 pr(" %d", xrel(np, ship.shp_orig_x));
378 if (ship.shp_own == ship.shp_orig_own || player->god)
379 pr(" %d", yrel(np, ship.shp_orig_y));
384 pr(" %c%s%c", '"', ship.shp_name, '"');
392 pr("%s: No ship(s)\n", player->argp[1]);
394 pr("%s: No ship(s)\n", "");
397 pr("%d ship%s\n", nships, splur(nships));