2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2000, 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:
60 if (!snxtitem(&ni, EF_SHIP, player->argp[1]))
64 if (!player->argp[2]) {
65 for (n = 1; n <= 34; n++) field[n-1] = n;
70 while (player->argp[n]) {
71 if (!strcmp("type",player->argp[n])) {
73 } else if (!strcmp("x",player->argp[n])) {
75 } else if (!strcmp("y",player->argp[n])) {
77 } else if (!strcmp("flt",player->argp[n])) {
79 } else if (!strcmp("eff",player->argp[n])) {
81 } else if (!strcmp("civ",player->argp[n])) {
83 } else if (!strcmp("mil",player->argp[n])) {
85 } else if (!strcmp("uw",player->argp[n])) {
87 } else if (!strcmp("food",player->argp[n])) {
89 } else if (!strcmp("pln",player->argp[n])) {
91 } else if (!strcmp("he",player->argp[n])) {
93 } else if (!strcmp("xl",player->argp[n])) {
95 } else if (!strcmp("land",player->argp[n])) {
97 } else if (!strcmp("mob",player->argp[n])) {
99 } else if (!strcmp("fuel",player->argp[n])) {
101 } else if (!strcmp("tech",player->argp[n])) {
103 } else if (!strcmp("shell",player->argp[n])) {
105 } else if (!strcmp("gun",player->argp[n])) {
107 } else if (!strcmp("petrol",player->argp[n])) {
109 } else if (!strcmp("iron",player->argp[n])) {
111 } else if (!strcmp("dust",player->argp[n])) {
113 } else if (!strcmp("bar",player->argp[n])) {
115 } else if (!strcmp("oil",player->argp[n])) {
117 } else if (!strcmp("lcm",player->argp[n])) {
119 } else if (!strcmp("hcm",player->argp[n])) {
121 } else if (!strcmp("rad",player->argp[n])) {
123 } else if (!strcmp("def",player->argp[n])) {
125 } else if (!strcmp("spd",player->argp[n])) {
127 } else if (!strcmp("vis",player->argp[n])) {
129 } else if (!strcmp("rng",player->argp[n])) {
131 } else if (!strcmp("fir",player->argp[n])) {
133 } else if (!strcmp("origx", player->argp[n])) {
135 } else if (!strcmp("origy", player->argp[n])) {
137 } else if (!strcmp("name",player->argp[n])) {
140 pr("Unrecognized field %s\n",player->argp[n]);
143 pr("Too many fields\n");
153 pr("DUMP SHIPS %d\n", now);
160 case 1: pr(" type"); break;
161 case 2: pr(" x"); break;
162 case 3: pr(" y"); break;
163 case 4: pr(" flt"); break;
164 case 5: pr(" eff"); break;
165 case 6: pr(" civ"); break;
166 case 7: pr(" mil"); break;
167 case 8: pr(" uw"); break;
168 case 9: pr(" food"); break;
169 case 10: pr(" pln"); break;
170 case 11: pr(" he"); break;
171 case 12: pr(" xl"); break;
172 case 13: pr(" land"); break;
173 case 14: pr(" mob"); break;
174 case 15: pr(" fuel"); break;
175 case 16: pr(" tech"); break;
176 case 17: pr(" shell"); break;
177 case 18: pr(" gun"); break;
178 case 19: pr(" petrol"); break;
179 case 20: pr(" iron"); break;
180 case 21: pr(" dust"); break;
181 case 22: pr(" bar"); break;
182 case 23: pr(" oil"); break;
183 case 24: pr(" lcm"); break;
184 case 25: pr(" hcm"); break;
185 case 26: pr(" rad"); break;
186 case 27: pr(" def"); break;
187 case 28: pr(" spd"); break;
188 case 29: pr(" vis"); break;
189 case 30: pr(" rng"); break;
190 case 31: pr(" fir"); break;
191 case 32: pr(" origx"); break;
192 case 33: pr(" origy"); break;
193 case 34: pr(" name"); break;
200 np = getnatp(player->cnum);
201 while (nxtitem(&ni, (s_char *)&ship)) {
202 if (!player->owner || ship.shp_own == 0)
204 if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
205 pr("bad ship type %d (#%d)\n",
206 ship.shp_type, ni.cur);
213 pr("%3d ", ship.shp_own);
216 getvec(VT_ITEM, vec, (s_char *)&ship, EF_SHIP);
218 switch (field[n++]) {
219 case 1: pr(" %0.4s", mchr[(int)ship.shp_type].m_name); break;
220 case 2: pr(" %d", xrel(np, ship.shp_x)); break;
221 case 3: pr(" %d", yrel(np, ship.shp_y)); break;
222 case 4: if (ship.shp_fleet == ' ')
225 pr(" %c", ship.shp_fleet);
227 case 5: pr(" %d", ship.shp_effic); break;
228 case 6: pr(" %d", vec[I_CIVIL]); break;
229 case 7: pr(" %d", vec[I_MILIT]); break;
230 case 8: pr(" %d", vec[I_UW]); break;
231 case 9: pr(" %d", vec[I_FOOD]); break;
232 case 10: pr(" %d", ship.shp_nplane); break;
233 case 11: pr(" %d",ship.shp_nchoppers); break;
234 case 12: pr(" %d",ship.shp_nxlight); break;
235 case 13: pr(" %d", ship.shp_nland); break;
236 case 14: pr(" %d", ship.shp_mobil); break;
237 case 15: if (opt_FUEL)
238 pr(" %d",ship.shp_fuel);
242 case 16: pr(" %d", ship.shp_tech); break;
243 case 17: pr(" %d", vec[I_SHELL]); break;
244 case 18: pr(" %d", vec[I_GUN]); break;
245 case 19: pr(" %d", vec[I_PETROL]); break;
246 case 20: pr(" %d", vec[I_IRON]); break;
247 case 21: pr(" %d", vec[I_DUST]); break;
248 case 22: pr(" %d", vec[I_BAR]); break;
249 case 23: pr(" %d", vec[I_OIL]); break;
250 case 24: pr(" %d", vec[I_LCM]); break;
251 case 25: pr(" %d", vec[I_HCM]); break;
252 case 26: pr(" %d", vec[I_RAD]); break;
253 case 27: pr(" %d", ship.shp_armor); break;
254 case 28: pr(" %d", ship.shp_speed); break;
255 case 29: pr(" %d", ship.shp_visib); break;
256 case 30: pr(" %d", ship.shp_frnge); break;
257 case 31: pr(" %d", ship.shp_glim); break;
258 case 32: pr(" %d", xrel(np, ship.shp_orig_x)); break;
259 case 33: pr(" %d", yrel(np, ship.shp_orig_y)); break;
260 case 34: pr(" %c%s%c", '"', ship.shp_name, '"'); break;
267 pr("%s: No ship(s)\n", player->argp[1]);
269 pr("%s: No ship(s)\n", "");
272 pr("%d ship%s\n", nships, splur(nships));