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:
48 static void cens_hdr(void);
56 struct nstr_sect nstr;
60 if (!snxtsct(&nstr, player->argp[1]))
63 for (n = 1; n <= 6; n++)
69 while (nxtsct(&nstr, §)) {
75 pr("%3d ", sect.sct_own);
76 prxy("%4d,%-4d", nstr.x, nstr.y, player->cnum);
77 pr(" %c", dchr[sect.sct_type].d_mnem);
78 if (sect.sct_newtype != sect.sct_type)
79 pr("%c", dchr[sect.sct_newtype].d_mnem);
82 pr("%4d%%", sect.sct_effic);
87 pr("%4d", sect.sct_mobil);
89 getvec(VT_DEL, vec, (s_char *)§, EF_SECTOR);
90 pr(" %c", dirstr[vec[I_UW] & 0x7]);
91 pr("%c", dirstr[vec[I_FOOD] & 0x7]);
93 getvec(VT_DIST, vec, (s_char *)§, EF_SECTOR);
95 pr(" %c", n == 0 ? '.' : '0'+ (n/100));
96 n = vec[I_FOOD] % 1000;
97 pr("%c ", n == 0 ? '.' : '0'+ (n/100));
98 pr("%c", sect.sct_own != sect.sct_oldown ? '*' : ' ');
100 getvec(VT_ITEM, vec, (s_char *)§, EF_SECTOR);
101 pr("%5d", vec[I_CIVIL]);
102 pr("%5d", vec[I_MILIT]);
103 pr("%5d", vec[I_UW]);
104 pr("%5d", vec[I_FOOD]);
105 pr("%4d%%", sect.sct_work);
106 pr("%5d", sect.sct_avail);
109 pr("%4d", sect.sct_terr);
114 getvec(VT_COND, vec, (void *)§, EF_SECTOR);
115 pr("%5d",vec[C_FALLOUT]);
118 if (sect.sct_coastal)
119 pr("%4d", sect.sct_coastal);
124 pr("%s: No sector(s)\n", player->argp[1]);
126 pr("%s: No sector(s)\n", "");
129 pr("%d sector%s\n", nsect, splur(nsect));
138 pr("CENSUS del dst\n");
143 pr("mob uf uf * civ mil uw food work avail ");
153 set_coastal(struct sctstr *sp)
157 u_char start_flags = sp->sct_coastal;
159 /* It's already been set, it didn't change (you can't fill
160 in water, even with bridge spans they are still coastal.) */
163 for (n = 1; n <= 6; ++n) { /* Directions */
164 getsect(sp->sct_x + diroff[n][0],
165 sp->sct_y + diroff[n][1],
167 if (sect.sct_type == SCT_WATER ||
168 sect.sct_type == SCT_BTOWER ||
169 sect.sct_type == SCT_BSPAN) {
171 if (start_flags != sp->sct_coastal)
177 if (start_flags != sp->sct_coastal)