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;
59 if (!snxtsct(&nstr, player->argp[1]))
62 for (n = 1; n <= 6; n++)
68 while (nxtsct(&nstr, §)) {
74 pr("%3d ", sect.sct_own);
75 prxy("%4d,%-4d", nstr.x, nstr.y, player->cnum);
76 pr(" %c", dchr[sect.sct_type].d_mnem);
77 if (sect.sct_newtype != sect.sct_type)
78 pr("%c", dchr[sect.sct_newtype].d_mnem);
81 pr("%4d%%", sect.sct_effic);
86 pr("%4d", sect.sct_mobil);
88 pr(" %c", dirstr[sect.sct_del[I_UW] & 0x7]);
89 pr("%c", dirstr[sect.sct_del[I_FOOD] & 0x7]);
91 n = sect.sct_dist[I_UW] % 1000;
92 pr(" %c", n == 0 ? '.' : '0' + (n / 100));
93 n = sect.sct_dist[I_FOOD] % 1000;
94 pr("%c ", n == 0 ? '.' : '0' + (n / 100));
95 pr("%c", sect.sct_own != sect.sct_oldown ? '*' : ' ');
97 getvec(VT_ITEM, vec, (s_char *)§, EF_SECTOR);
98 pr("%5d", vec[I_CIVIL]);
99 pr("%5d", vec[I_MILIT]);
100 pr("%5d", vec[I_UW]);
101 pr("%5d", vec[I_FOOD]);
102 pr("%4d%%", sect.sct_work);
103 pr("%5d", sect.sct_avail);
106 pr("%4d", sect.sct_terr);
111 pr("%5d", sect.sct_fallout);
114 if (sect.sct_coastal)
115 pr("%4d", sect.sct_coastal);
120 pr("%s: No sector(s)\n", player->argp[1]);
122 pr("%s: No sector(s)\n", "");
125 pr("%d sector%s\n", nsect, splur(nsect));
134 pr("CENSUS del dst\n");
139 pr("mob uf uf * civ mil uw food work avail ");
149 set_coastal(struct sctstr *sp)
153 u_char start_flags = sp->sct_coastal;
155 /* It's already been set, it didn't change (you can't fill
156 in water, even with bridge spans they are still coastal.) */
159 for (n = 1; n <= 6; ++n) { /* Directions */
160 getsect(sp->sct_x + diroff[n][0], sp->sct_y + diroff[n][1], §);
161 if (sect.sct_type == SCT_WATER ||
162 sect.sct_type == SCT_BTOWER || sect.sct_type == SCT_BSPAN) {
164 if (start_flags != sp->sct_coastal)
170 if (start_flags != sp->sct_coastal)