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 * cens.c: Do a census report
30 * Known contributors to this file:
47 static void cens_hdr(void);
55 struct nstr_sect nstr;
58 if (!snxtsct(&nstr, player->argp[1]))
61 for (n = 1; n <= 6; n++)
67 while (nxtsct(&nstr, §)) {
73 pr("%3d ", sect.sct_own);
74 prxy("%4d,%-4d", nstr.x, nstr.y, player->cnum);
75 pr(" %c", dchr[sect.sct_type].d_mnem);
76 if (sect.sct_newtype != sect.sct_type)
77 pr("%c", dchr[sect.sct_newtype].d_mnem);
80 pr("%4d%%", sect.sct_effic);
85 pr("%4d", sect.sct_mobil);
87 pr(" %c", dirstr[sect.sct_del[I_UW] & 0x7]);
88 pr("%c", dirstr[sect.sct_del[I_FOOD] & 0x7]);
90 n = sect.sct_dist[I_UW] % 1000;
91 pr(" %c", n == 0 ? '.' : '0' + (n / 100));
92 n = sect.sct_dist[I_FOOD] % 1000;
93 pr("%c ", n == 0 ? '.' : '0' + (n / 100));
94 pr("%c", sect.sct_own != sect.sct_oldown ? '*' : ' ');
96 pr("%5d", sect.sct_item[I_CIVIL]);
97 pr("%5d", sect.sct_item[I_MILIT]);
98 pr("%5d", sect.sct_item[I_UW]);
99 pr("%5d", sect.sct_item[I_FOOD]);
100 pr("%4d%%", sect.sct_work);
101 pr("%5d", sect.sct_avail);
104 pr("%4d", sect.sct_terr);
109 pr("%5d", sect.sct_fallout);
112 if (sect.sct_coastal)
113 pr("%4d", sect.sct_coastal);
118 pr("%s: No sector(s)\n", player->argp[1]);
120 pr("%s: No sector(s)\n", "");
123 pr("%d sector%s\n", nsect, splur(nsect));
132 pr("CENSUS del dst\n");
137 pr("mob uf uf * civ mil uw food work avail ");
147 set_coastal(struct sctstr *sp)
151 u_char start_flags = sp->sct_coastal;
153 /* It's already been set, it didn't change (you can't fill
154 in water, even with bridge spans they are still coastal.) */
157 for (n = 1; n <= 6; ++n) { /* Directions */
158 getsect(sp->sct_x + diroff[n][0], sp->sct_y + diroff[n][1], §);
159 if (sect.sct_type == SCT_WATER ||
160 sect.sct_type == SCT_BTOWER || sect.sct_type == SCT_BSPAN) {
162 if (start_flags != sp->sct_coastal)
168 if (start_flags != sp->sct_coastal)