2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2007, 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 files README, COPYING and CREDITS in the root of the source
23 * tree for related information and legal notices. It is expected
24 * that future projects/authors will amend these files as needed.
28 * unitsub.c: Common subroutines for multiple type of units
30 * Known contributors to this file:
31 * Ron Koenderink, 2007
38 #include "prototypes.h"
42 unit_list(struct emp_qelem *unit_list)
45 struct emp_qelem *next;
51 CANT_HAPPEN(QEMPTY(unit_list));
53 qp = unit_list->q_back;
54 ulp = (struct ulist *)qp;
56 if (ulp->unit.ef_type == EF_LAND)
57 pr("lnd# land type x,y a eff sh gun xl mu tech retr fuel\n");
59 pr("shp# ship type x,y fl eff mil sh gun pn he xl ln mob tech\n");
61 for (; qp != unit_list; qp = next) {
63 ulp = (struct ulist *)qp;
64 lnd = &ulp->unit.land;
65 shp = &ulp->unit.ship;
66 unit = &ulp->unit.gen;
67 pr("%4d ", unit->uid);
68 pr("%-16.16s ", emp_obj_chr_name(unit));
69 prxy("%4d,%-4d ", unit->x, unit->y, unit->own);
70 pr("%1.1s", &unit->group);
71 pr("%4d%%", unit->effic);
72 if (unit->ef_type == EF_LAND) {
73 pr("%4d", lnd->lnd_item[I_SHELL]);
74 pr("%4d", lnd->lnd_item[I_GUN]);
75 count_land_planes(lnd);
76 pr("%3d", lnd->lnd_nxlight);
78 pr("%4d", shp->shp_item[I_MILIT]);
79 pr("%4d", shp->shp_item[I_SHELL]);
80 pr("%4d", shp->shp_item[I_GUN]);
82 pr("%3d", shp->shp_nplane);
83 pr("%3d", shp->shp_nchoppers);
84 pr("%3d", shp->shp_nxlight);
86 pr("%3d", shp->shp_nland);
88 pr("%4d", unit->mobil);
89 pr("%4d", unit->tech);
90 if (unit->ef_type == EF_LAND) {
91 pr("%4d%%", lnd->lnd_retreat);
92 pr("%5d", lnd->lnd_fuel);