2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2005, 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 * nsc.c: Empire selection global structures
30 * Known contributors to this file:
31 * Markus Armbruster, 2004
51 #include "commodity.h"
56 #define fldoff(str, fld) offsetof(struct str, fld)
58 #define NSC_IELT(name, pfx, sfx, base, itype) \
59 {NSC_SHORT, 0, 0, ((base) + (itype)*sizeof(u_short)), \
60 sizeof(sfx) == 1 ? name : pfx sfx, EF_BAD}
62 #define NSC_IVEC(base, sfx) \
63 NSC_IELT("civil", "c", sfx, base, I_CIVIL), \
64 NSC_IELT("milit", "m", sfx, base, I_MILIT), \
65 NSC_IELT("shell", "s", sfx, base, I_SHELL), \
66 NSC_IELT("gun", "g", sfx, base, I_GUN), \
67 NSC_IELT("petrol", "p", sfx, base, I_PETROL), \
68 NSC_IELT("iron", "i", sfx, base, I_IRON), \
69 NSC_IELT("dust", "d", sfx, base, I_DUST), \
70 NSC_IELT("bar", "b", sfx, base, I_BAR), \
71 NSC_IELT("food", "f", sfx, base, I_FOOD), \
72 NSC_IELT("oil", "o", sfx, base, I_OIL), \
73 NSC_IELT("lcm", "l", sfx, base, I_LCM), \
74 NSC_IELT("hcm", "h", sfx, base, I_HCM), \
75 NSC_IELT("uw", "u", sfx, base, I_UW), \
76 NSC_IELT("rad", "r", sfx, base, I_RAD)
78 struct castr ichr_ca[] = {
79 {NSC_SITYPE(i_type), 0, 0, offsetof(struct ichrstr, i_vtype), "vtype",
81 {NSC_STRING, 0, 0, offsetof(struct ichrstr, i_name), "name", EF_BAD},
82 {NSC_INT, NSC_CONST, 0, offsetof(struct ichrstr, i_mnem), "mnem", EF_BAD},
83 {NSC_INT, 0, 0, offsetof(struct ichrstr, i_value), "value", EF_BAD},
84 {NSC_INT, 0, 0, offsetof(struct ichrstr, i_sell), "sell", EF_BAD},
85 {NSC_INT, 0, 0, offsetof(struct ichrstr, i_lbs), "lbs", EF_BAD},
86 {NSC_INT, 0, NUMPKG, offsetof(struct ichrstr, i_pkg), "pkg", EF_BAD},
87 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
90 struct castr pchr_ca[] = {
91 {NSC_STRING, 0, 0, offsetof(struct pchrstr, p_name), "name", EF_BAD},
92 {NSC_STRING, NSC_CONST, 0, offsetof(struct pchrstr, p_sname), "sname",
94 {NSC_SITYPE(i_type), 0, MAXPRCON, offsetof(struct pchrstr, p_ctype),
96 {NSC_USHORT, 0, MAXPRCON, offsetof(struct pchrstr, p_camt), "camt",
98 {NSC_SITYPE(i_type), 0, 0, offsetof(struct pchrstr, p_type), "type",
100 {NSC_INT, 0, 0, offsetof(struct pchrstr, p_level), "level", EF_BAD},
101 {NSC_INT, 0, 0, offsetof(struct pchrstr, p_cost), "cost", EF_BAD},
102 {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nrndx), "nrndx", EF_BAD},
103 {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nrdep), "nrdep", EF_BAD},
104 {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nlndx), "nlndx", EF_BAD},
105 {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nlmin), "nlmin", EF_BAD},
106 {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nllag), "nllag", EF_BAD},
107 {NSC_INT, 0, 0, offsetof(struct pchrstr, p_effic), "effic", EF_BAD},
108 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
111 struct castr sect_ca[] = {
112 {NSC_NATID, 0, 0, fldoff(sctstr, sct_own), "owner", EF_NATION},
113 {NSC_XCOORD, 0, 0, fldoff(sctstr, sct_x), "xloc", EF_BAD},
114 {NSC_YCOORD, 0, 0, fldoff(sctstr, sct_y), "yloc", EF_BAD},
115 {NSC_TYPEID, 0, 0, fldoff(sctstr, sct_type), "des", EF_SECTOR_CHR},
116 {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_effic), "effic", EF_BAD},
117 {NSC_SHORT, 0, 0, fldoff(sctstr, sct_mobil), "mobil", EF_BAD},
118 {NSC_UCHAR, NSC_DEITY, 0, fldoff(sctstr, sct_loyal), "loyal", EF_BAD},
119 {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr), "terr", EF_BAD},
120 {NSC_UCHAR, NSC_EXTRA, 0, fldoff(sctstr, sct_terr), "terr0", EF_BAD},
121 {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr1), "terr1", EF_BAD},
122 {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr2), "terr2", EF_BAD},
123 {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr3), "terr3", EF_BAD},
124 {NSC_XCOORD, 0, 0, fldoff(sctstr, sct_dist_x), "xdist", EF_BAD},
125 {NSC_YCOORD, 0, 0, fldoff(sctstr, sct_dist_y), "ydist", EF_BAD},
126 {NSC_SHORT, 0, 0, fldoff(sctstr, sct_avail), "avail", EF_BAD},
127 {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_work), "work", EF_BAD},
128 {NSC_UCHAR, NSC_EXTRA, 0, fldoff(sctstr, sct_coastal), "coastal", EF_BAD},
129 {NSC_TYPEID, 0, 0, fldoff(sctstr, sct_newtype), "newdes", EF_SECTOR_CHR},
130 {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_min), "min", EF_BAD},
131 {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_gmin), "gold", EF_BAD},
132 {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_fertil), "fert", EF_BAD},
133 {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_oil), "ocontent", EF_BAD},
134 {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_uran), "uran", EF_BAD},
135 {NSC_NATID, 0, 0, fldoff(sctstr, sct_oldown), "oldown", EF_NATION},
136 {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_off), "off", EF_BAD},
137 NSC_IVEC(fldoff(sctstr, sct_item), ""),
138 NSC_IVEC(fldoff(sctstr, sct_dist), "_dist"),
139 NSC_IVEC(fldoff(sctstr, sct_del), "_del"),
140 {NSC_SHORT, NSC_DEITY, 0, fldoff(sctstr, sct_mines), "mines", EF_BAD},
141 {NSC_SHORT, NSC_DEITY, 0, fldoff(sctstr, sct_pstage), "pstage", EF_BAD},
142 {NSC_SHORT, NSC_DEITY, 0, fldoff(sctstr, sct_ptime), "ptime", EF_BAD},
143 {NSC_UCHAR, NSC_DEITY, 0, fldoff(sctstr, sct_che), "che", EF_BAD},
144 {NSC_NATID, NSC_DEITY, 0, fldoff(sctstr, sct_che_target), "che_target",
146 {NSC_USHORT, 0, 0, fldoff(sctstr, sct_fallout), "fallout", EF_BAD},
147 {NSC_TIME, 0, 0, fldoff(sctstr, sct_access), "access", EF_BAD},
148 {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_road), "road", EF_BAD},
149 {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_rail), "rail", EF_BAD},
150 {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_defense), "dfense", EF_BAD},
151 {NSC_TIME, NSC_EXTRA, 0, fldoff(sctstr, sct_timestamp), "timestamp",
153 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
156 struct castr dchr_ca[] = {
157 {NSC_STRING, 0, 0, offsetof(struct dchrstr, d_name), "name", EF_BAD},
158 {NSC_INT, NSC_CONST, 0, offsetof(struct dchrstr, d_mnem), "mnem", EF_BAD},
159 {NSC_INT, 0, 0, offsetof(struct dchrstr, d_prd), "prd", EF_BAD},
160 {NSC_INT, 0, 0, offsetof(struct dchrstr, d_mcst), "mcst", EF_BAD},
161 {NSC_INT, 0, 0, offsetof(struct dchrstr, d_flg), "flg", EF_BAD},
162 {NSC_SITYPE(i_packing), 0, 0, offsetof(struct dchrstr, d_pkg), "pkg",
164 {NSC_FLOAT, 0, 0, offsetof(struct dchrstr, d_ostr), "ostr", EF_BAD},
165 {NSC_FLOAT, 0, 0, offsetof(struct dchrstr, d_dstr), "dstr", EF_BAD},
166 {NSC_INT, 0, 0, offsetof(struct dchrstr, d_value), "value", EF_BAD},
167 {NSC_INT, 0, 0, offsetof(struct dchrstr, d_cost), "cost", EF_BAD},
168 {NSC_INT, 0, 0, offsetof(struct dchrstr, d_build), "build", EF_BAD},
169 {NSC_INT, 0, 0, offsetof(struct dchrstr, d_lcms), "lcms", EF_BAD},
170 {NSC_INT, 0, 0, offsetof(struct dchrstr, d_hcms), "hcms", EF_BAD},
171 {NSC_INT, 0, 0, offsetof(struct dchrstr, d_maxpop), "maxpop", EF_BAD},
172 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
175 #define NSC_GENITEM(ef_type, ef_chr) \
176 { NSC_SHORT, 0, 0, fldoff(genitem, uid), "uid", ef_type}, \
177 { NSC_NATID, 0, 0, fldoff(genitem, own), "owner", EF_NATION}, \
178 { NSC_XCOORD, 0, 0, fldoff(genitem, x), "xloc", EF_BAD}, \
179 { NSC_YCOORD, 0, 0, fldoff(genitem, y), "yloc", EF_BAD}, \
180 { NSC_TYPEID, 0, 0, fldoff(genitem, type), "type", ef_chr}, \
181 { NSC_CHAR, 0, 0, fldoff(genitem, effic), "effic", EF_BAD}, \
182 { NSC_CHAR , 0, 0, fldoff(genitem, mobil), "mobil", EF_BAD}, \
183 { NSC_SHORT, 0, 0, fldoff(genitem, tech), "tech", EF_BAD}, \
184 { NSC_CHAR, NSC_EXTRA, 0, fldoff(genitem, group), "group", EF_BAD}, \
185 { NSC_XCOORD, 0, 0, fldoff(genitem, opx), "opx", EF_BAD}, \
186 { NSC_YCOORD, 0, 0, fldoff(genitem, opy), "opy", EF_BAD}, \
187 { NSC_SHORT, 0, 0, fldoff(genitem, mission), "mission", EF_BAD}, \
188 { NSC_SHORT, 0, 0, fldoff(genitem, radius), "radius", EF_BAD}
190 struct castr ship_ca[] = {
191 NSC_GENITEM(EF_SHIP, EF_SHIP_CHR),
192 {NSC_CHAR, 0, 0, fldoff(shpstr, shp_fleet), "fleet", EF_BAD},
193 {NSC_UCHAR, NSC_EXTRA, 0, fldoff(shpstr, shp_nplane), "nplane", EF_BAD},
194 {NSC_UCHAR, NSC_EXTRA, 0, fldoff(shpstr, shp_nland), "nland", EF_BAD},
195 {NSC_XCOORD, 0, 0, fldoff(shpstr, shp_destx[0]), "xstart", EF_BAD},
196 {NSC_XCOORD, 0, 0, fldoff(shpstr, shp_destx[1]), "xend", EF_BAD},
197 {NSC_YCOORD, 0, 0, fldoff(shpstr, shp_desty[0]), "ystart", EF_BAD},
198 {NSC_YCOORD, 0, 0, fldoff(shpstr, shp_desty[1]), "yend", EF_BAD},
199 {NSC_SITYPE(i_type), 0, TMAX, fldoff(shpstr, shp_tstart), "cargostart",
201 {NSC_SITYPE(i_type), 0, TMAX, fldoff(shpstr, shp_tend), "cargoend",
203 {NSC_SHORT, 0, TMAX, fldoff(shpstr, shp_lstart), "amtstart", EF_BAD},
204 {NSC_SHORT, 0, TMAX, fldoff(shpstr, shp_lend), "amtend", EF_BAD},
205 {NSC_UCHAR, 0, 0, fldoff(shpstr, shp_autonav), "autonav", EF_BAD},
206 NSC_IVEC(fldoff(shpstr, shp_item), ""),
207 {NSC_SHORT, NSC_DEITY, 0, fldoff(shpstr, shp_pstage), "pstage", EF_BAD},
208 {NSC_SHORT, NSC_DEITY, 0, fldoff(shpstr, shp_ptime), "ptime", EF_BAD},
209 {NSC_TIME, 0, 0, fldoff(shpstr, shp_access), "access", EF_BAD},
210 {NSC_TIME, NSC_EXTRA, 0, fldoff(shpstr, shp_timestamp), "timestamp",
212 {NSC_UCHAR, 0, 0, fldoff(shpstr, shp_mobquota), "mquota", EF_BAD},
213 {NSC_STRINGY, 0, MAXSHPPATH, fldoff(shpstr, shp_path), "path", EF_BAD},
214 {NSC_SHORT, 0, 0, fldoff(shpstr, shp_follow), "follow", EF_BAD},
215 {NSC_STRINGY, 0, MAXSHPNAMLEN, fldoff(shpstr, shp_name), "name", EF_BAD},
216 {NSC_UCHAR, 0, 0, fldoff(shpstr, shp_fuel), "fuel", EF_BAD},
217 {NSC_UCHAR, NSC_EXTRA, 0, fldoff(shpstr, shp_nchoppers), "nchoppers",
219 {NSC_UCHAR, NSC_EXTRA, 0, fldoff(shpstr, shp_nxlight), "nxlight", EF_BAD},
220 /* could let builder access these, but we can't express that yet: */
221 {NSC_XCOORD, NSC_DEITY, 0, fldoff(shpstr, shp_orig_x), "xbuilt", EF_BAD},
222 {NSC_YCOORD, NSC_DEITY, 0, fldoff(shpstr, shp_orig_y), "ybuilt", EF_BAD},
223 {NSC_NATID, NSC_DEITY, 0, fldoff(shpstr, shp_orig_own), "builder",
225 {NSC_INT, NSC_BITS, 0, fldoff(shpstr, shp_rflags), "rflags", EF_BAD},
226 {NSC_STRINGY, 0, RET_LEN, fldoff(shpstr, shp_rpath), "rpath", EF_BAD},
227 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
230 struct castr mchr_ca[] = {
231 {NSC_STRING, 0, 0, offsetof(struct mchrstr, m_name), "name", EF_BAD},
232 {NSC_USHORT, 0, I_MAX+1, offsetof(struct mchrstr, m_item), "item", EF_BAD},
233 {NSC_INT, 0, 0, offsetof(struct mchrstr, m_lcm), "lcm", EF_BAD},
234 {NSC_INT, 0, 0, offsetof(struct mchrstr, m_hcm), "hcm", EF_BAD},
235 {NSC_INT, 0, 0, offsetof(struct mchrstr, m_armor), "armor", EF_BAD},
236 {NSC_INT, 0, 0, offsetof(struct mchrstr, m_speed), "speed", EF_BAD},
237 {NSC_INT, 0, 0, offsetof(struct mchrstr, m_visib), "visib", EF_BAD},
238 {NSC_INT, 0, 0, offsetof(struct mchrstr, m_vrnge), "vrnge", EF_BAD},
239 {NSC_INT, 0, 0, offsetof(struct mchrstr, m_frnge), "frnge", EF_BAD},
240 {NSC_INT, 0, 0, offsetof(struct mchrstr, m_glim), "glim", EF_BAD},
241 {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_nxlight), "nxlight", EF_BAD},
242 {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_nchoppers), "nchoppers",
244 {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_fuelc), "fuelc", EF_BAD},
245 {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_fuelu), "fuelu", EF_BAD},
246 {NSC_INT, 0, 0, offsetof(struct mchrstr, m_tech), "tech", EF_BAD},
247 {NSC_INT, 0, 0, offsetof(struct mchrstr, m_cost), "cost", EF_BAD},
248 {NSC_LONG, NSC_BITS, 0, offsetof(struct mchrstr, m_flags), "flags",
250 {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_nplanes), "nplanes", EF_BAD},
251 {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_nland), "nland", EF_BAD},
252 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
255 struct castr plane_ca[] = {
256 NSC_GENITEM(EF_PLANE, EF_PLANE_CHR),
257 {NSC_CHAR, 0, 0, fldoff(plnstr, pln_wing), "wing", EF_BAD},
258 {NSC_UCHAR, 0, 0, fldoff(plnstr, pln_range), "range", EF_BAD},
259 {NSC_SHORT, 0, 0, fldoff(plnstr, pln_ship), "ship", EF_BAD},
260 {NSC_SHORT, 0, 0, fldoff(plnstr, pln_land), "land", EF_BAD},
261 {NSC_INT, NSC_EXTRA, 0, fldoff(plnstr, pln_att), "att", EF_BAD},
262 {NSC_INT, NSC_EXTRA, 0, fldoff(plnstr, pln_def), "def", EF_BAD},
263 {NSC_CHAR, 0, 0, fldoff(plnstr, pln_harden), "harden", EF_BAD},
264 {NSC_CHAR, 0, 0, fldoff(plnstr, pln_nuketype), "nuketype", EF_BAD},
265 {NSC_CHAR, NSC_BITS, 0, fldoff(plnstr, pln_flags), "flags", EF_BAD},
266 {NSC_TIME, 0, 0, fldoff(plnstr, pln_access), "access", EF_BAD},
267 {NSC_TIME, NSC_EXTRA, 0, fldoff(plnstr, pln_timestamp), "timestamp",
269 {NSC_FLOAT, 0, 0, fldoff(plnstr, pln_theta), "theta", EF_BAD},
270 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
273 struct castr plchr_ca[] = {
274 {NSC_STRING, 0, 0, offsetof(struct plchrstr, pl_name), "name", EF_BAD},
275 {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_lcm), "lcm", EF_BAD},
276 {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_hcm), "hcm", EF_BAD},
277 {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_cost), "cost", EF_BAD},
278 {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_tech), "tech", EF_BAD},
279 {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_acc), "acc", EF_BAD},
280 {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_load), "load", EF_BAD},
281 {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_att), "att", EF_BAD},
282 {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_def), "def", EF_BAD},
283 {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_range), "range", EF_BAD},
284 {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_crew), "crew", EF_BAD},
285 {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_fuel), "fuel", EF_BAD},
286 {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_stealth), "stealth", EF_BAD},
287 {NSC_INT, NSC_BITS, 0, offsetof(struct plchrstr, pl_flags), "flags",
289 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
292 struct castr land_ca[] = {
293 NSC_GENITEM(EF_LAND, EF_LAND_CHR),
294 {NSC_CHAR, 0, 0, fldoff(lndstr, lnd_army), "army", EF_BAD},
295 {NSC_SHORT, 0, 0, fldoff(lndstr, lnd_ship), "ship", EF_BAD},
296 {NSC_CHAR, 0, 0, fldoff(lndstr, lnd_harden), "harden", EF_BAD},
297 {NSC_SHORT, 0, 0, fldoff(lndstr, lnd_retreat), "retreat", EF_BAD},
298 {NSC_UCHAR, 0, 0, fldoff(lndstr, lnd_fuel), "fuel", EF_BAD},
299 {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_nxlight), "nxlight", EF_BAD},
300 {NSC_INT, NSC_BITS, 0, fldoff(lndstr, lnd_rflags), "rflags", EF_BAD},
301 {NSC_STRINGY, 0, RET_LEN, fldoff(lndstr, lnd_rpath), "rpath", EF_BAD},
302 {NSC_UCHAR, 0, 0, fldoff(lndstr, lnd_rad_max), "react", EF_BAD},
303 NSC_IVEC(fldoff(lndstr, lnd_item), ""),
304 {NSC_SHORT, NSC_DEITY, 0, fldoff(lndstr, lnd_pstage), "pstage", EF_BAD},
305 {NSC_SHORT, NSC_DEITY, 0, fldoff(lndstr, lnd_ptime), "ptime", EF_BAD},
306 {NSC_SHORT, 0, 0, fldoff(lndstr, lnd_land), "land", EF_BAD},
307 {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_nland), "nland", EF_BAD},
308 {NSC_TIME, 0, 0, fldoff(lndstr, lnd_access), "access", EF_BAD},
309 {NSC_FLOAT, NSC_EXTRA, 0, fldoff(lndstr, lnd_att), "att", EF_BAD},
310 {NSC_FLOAT, NSC_EXTRA, 0, fldoff(lndstr, lnd_def), "def", EF_BAD},
311 {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_vul), "vul", EF_BAD},
312 {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_spd), "spd", EF_BAD},
313 {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_vis), "vis", EF_BAD},
314 {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_spy), "spy", EF_BAD},
315 {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_rad), "rmax", EF_BAD},
316 {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_frg), "frg", EF_BAD},
317 {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_acc), "acc", EF_BAD},
318 {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_dam), "dam", EF_BAD},
319 {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_ammo), "ammo", EF_BAD},
320 {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_aaf), "aaf", EF_BAD},
321 {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_fuelc), "fuelc", EF_BAD},
322 {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_fuelu), "fuelu", EF_BAD},
323 {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_maxlight), "maxlight",
325 {NSC_TIME, NSC_EXTRA, 0, fldoff(lndstr, lnd_timestamp), "timestamp",
327 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
330 struct castr lchr_ca[] = {
331 {NSC_STRING, 0, 0, offsetof(struct lchrstr, l_name), "name", EF_BAD},
332 {NSC_USHORT, 0, I_MAX+1, offsetof(struct mchrstr, m_item), "item", EF_BAD},
333 {NSC_INT, 0, 0, offsetof(struct lchrstr, l_lcm), "lcm", EF_BAD},
334 {NSC_INT, 0, 0, offsetof(struct lchrstr, l_hcm), "hcm", EF_BAD},
335 {NSC_INT, 0, 0, offsetof(struct lchrstr, l_gun), "gun", EF_BAD},
336 {NSC_INT, 0, 0, offsetof(struct lchrstr, l_shell), "shell", EF_BAD},
337 {NSC_INT, 0, 0, offsetof(struct lchrstr, l_tech), "tech", EF_BAD},
338 {NSC_INT, 0, 0, offsetof(struct lchrstr, l_cost), "cost", EF_BAD},
339 {NSC_FLOAT, 0, 0, offsetof(struct lchrstr, l_att), "att", EF_BAD},
340 {NSC_FLOAT, 0, 0, offsetof(struct lchrstr, l_def), "def", EF_BAD},
341 {NSC_INT, 0, 0, offsetof(struct lchrstr, l_vul), "vul", EF_BAD},
342 {NSC_INT, 0, 0, offsetof(struct lchrstr, l_spd), "spd", EF_BAD},
343 {NSC_INT, 0, 0, offsetof(struct lchrstr, l_vis), "vis", EF_BAD},
344 {NSC_INT, 0, 0, offsetof(struct lchrstr, l_spy), "spy", EF_BAD},
345 {NSC_INT, 0, 0, offsetof(struct lchrstr, l_rad), "rad", EF_BAD},
346 {NSC_INT, 0, 0, offsetof(struct lchrstr, l_frg), "frg", EF_BAD},
347 {NSC_INT, 0, 0, offsetof(struct lchrstr, l_acc), "acc", EF_BAD},
348 {NSC_INT, 0, 0, offsetof(struct lchrstr, l_dam), "dam", EF_BAD},
349 {NSC_INT, 0, 0, offsetof(struct lchrstr, l_ammo), "ammo", EF_BAD},
350 {NSC_INT, 0, 0, offsetof(struct lchrstr, l_aaf), "aaf", EF_BAD},
351 {NSC_UCHAR, 0, 0, offsetof(struct lchrstr, l_fuelc), "fuelc", EF_BAD},
352 {NSC_UCHAR, 0, 0, offsetof(struct lchrstr, l_fuelu), "fuelu", EF_BAD},
353 {NSC_UCHAR, 0, 0, offsetof(struct lchrstr, l_nxlight), "nxlight", EF_BAD},
354 {NSC_UCHAR, 0, 0, offsetof(struct lchrstr, l_mxland), "mxland", EF_BAD},
355 {NSC_LONG, NSC_BITS, 0, offsetof(struct lchrstr, l_flags), "flags",
357 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
360 struct castr nuke_ca[] = {
361 {NSC_SHORT, 0, 0, fldoff(nukstr, nuk_uid), "uid", EF_NUKE},
362 {NSC_NATID, 0, 0, fldoff(nukstr, nuk_own), "owner", EF_NATION},
363 {NSC_XCOORD, 0, 0, fldoff(nukstr, nuk_x), "xloc", EF_BAD},
364 {NSC_YCOORD, 0, 0, fldoff(nukstr, nuk_y), "yloc", EF_BAD},
365 {NSC_CHAR, 0, 0, fldoff(nukstr, nuk_n), "number", EF_BAD},
366 {NSC_SHORT, 0, N_MAXNUKE, fldoff(nukstr, nuk_types), "types", EF_NUKE_CHR},
367 {NSC_TIME, NSC_EXTRA, 0, fldoff(nukstr, nuk_timestamp), "timestamp",
369 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
372 struct castr nchr_ca[] = {
373 {NSC_STRING, 0, 0, offsetof(struct nchrstr, n_name), "name", EF_BAD},
374 {NSC_INT, 0, 0, offsetof(struct nchrstr, n_lcm), "lcm", EF_BAD},
375 {NSC_INT, 0, 0, offsetof(struct nchrstr, n_hcm), "hcm", EF_BAD},
376 {NSC_INT, 0, 0, offsetof(struct nchrstr, n_oil), "oil", EF_BAD},
377 {NSC_INT, 0, 0, offsetof(struct nchrstr, n_rad), "rad", EF_BAD},
378 {NSC_INT, 0, 0, offsetof(struct nchrstr, n_blast), "blast", EF_BAD},
379 {NSC_INT, 0, 0, offsetof(struct nchrstr, n_dam), "dam", EF_BAD},
380 {NSC_INT, 0, 0, offsetof(struct nchrstr, n_cost), "cost", EF_BAD},
381 {NSC_INT, 0, 0, offsetof(struct nchrstr, n_tech), "tech", EF_BAD},
382 {NSC_INT, 0, 0, offsetof(struct nchrstr, n_weight), "weight", EF_BAD},
383 {NSC_INT, NSC_BITS, 0, offsetof(struct nchrstr, n_flags), "flags",
385 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
388 struct castr treaty_ca[] = {
389 {NSC_SHORT, 0, 0, fldoff(trtstr, trt_uid), "uid", EF_TREATY},
390 {NSC_NATID, 0, 0, fldoff(trtstr, trt_cna), "cna", EF_NATION},
391 {NSC_NATID, 0, 0, fldoff(trtstr, trt_cnb), "cnb", EF_NATION},
392 {NSC_CHAR, 0, 0, fldoff(trtstr, trt_status), "status", EF_BAD},
393 {NSC_SHORT, NSC_BITS, 0, fldoff(trtstr, trt_acond), "acond",
395 {NSC_SHORT, NSC_BITS, 0, fldoff(trtstr, trt_bcond), "bcond",
397 {NSC_TIME, 0, 0, fldoff(trtstr, trt_exp), "exp", EF_BAD},
398 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
401 struct castr loan_ca[] = {
402 {NSC_SHORT, 0, 0, fldoff(lonstr, l_uid), "uid", EF_LOAN},
403 {NSC_NATID, 0, 0, fldoff(lonstr, l_loner), "loaner", EF_NATION},
404 {NSC_NATID, 0, 0, fldoff(lonstr, l_lonee), "loanee", EF_NATION},
405 {NSC_CHAR, 0, 0, fldoff(lonstr, l_status), "status", EF_BAD},
406 {NSC_INT, 0, 0, fldoff(lonstr, l_irate), "irate", EF_BAD},
407 {NSC_INT, 0, 0, fldoff(lonstr, l_ldur), "ldur", EF_BAD},
408 {NSC_LONG, 0, 0, fldoff(lonstr, l_amtpaid), "amtpaid", EF_BAD},
409 {NSC_LONG, 0, 0, fldoff(lonstr, l_amtdue), "amtdue", EF_BAD},
410 {NSC_TIME, 0, 0, fldoff(lonstr, l_lastpay), "lastpay", EF_BAD},
411 {NSC_TIME, 0, 0, fldoff(lonstr, l_duedate), "duedate", EF_BAD},
412 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
415 struct castr news_ca[] = {
416 {NSC_SHORT, 0, 0, fldoff(nwsstr, nws_uid), "uid", EF_NEWS},
417 {NSC_NATID, 0, 0, fldoff(nwsstr, nws_ano), "actor", EF_NATION},
418 {NSC_CHAR, 0, 0, fldoff(nwsstr, nws_vrb), "action", EF_NEWS_CHR},
419 {NSC_NATID, 0, 0, fldoff(nwsstr, nws_vno), "victim", EF_NATION},
420 {NSC_CHAR, 0, 0, fldoff(nwsstr, nws_ntm), "times", EF_BAD},
421 {NSC_TIME, 0, 0, fldoff(nwsstr, nws_when), "time", EF_BAD},
422 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
425 struct castr lost_ca[] = {
426 {NSC_INT, 0, 0, fldoff(loststr, lost_uid), "uid", EF_LOST},
427 {NSC_NATID, 0, 0, fldoff(loststr, lost_owner), "owner", EF_NATION},
428 {NSC_CHAR, 0, 0, fldoff(loststr, lost_type), "type", EF_BAD},
429 {NSC_SHORT, 0, 0, fldoff(loststr, lost_id), "id", EF_BAD},
430 {NSC_XCOORD, 0, 0, fldoff(loststr, lost_x), "x", EF_BAD},
431 {NSC_YCOORD, 0, 0, fldoff(loststr, lost_y), "y", EF_BAD},
432 {NSC_TIME, 0, 0, fldoff(loststr, lost_timestamp), "timestamp", EF_BAD},
433 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
436 struct castr commodity_ca[] = {
437 {NSC_SHORT, 0, 0, fldoff(comstr, com_uid), "uid", EF_COMM},
438 {NSC_NATID, 0, 0, fldoff(comstr, com_owner), "owner", EF_NATION},
439 {NSC_SITYPE(i_type), 0, 0, fldoff(comstr, com_type), "type", EF_ITEM},
440 {NSC_INT, 0, 0, fldoff(comstr, com_amount), "amount", EF_BAD},
441 {NSC_INT, 0, 0, fldoff(comstr, com_maxbidder), "maxbidder", EF_NATION},
442 {NSC_TIME, 0, 0, fldoff(comstr, com_markettime), "markettime", EF_BAD},
443 /* could let maxbidder access these, but we can't express that yet: */
444 {NSC_XCOORD, NSC_DEITY, 0, fldoff(comstr, com_x), "xbuy", EF_BAD},
445 {NSC_XCOORD, NSC_DEITY, 0, fldoff(comstr, com_y), "ybuy", EF_BAD},
446 /* could let the owner access these, but we can't express that yet: */
447 {NSC_XCOORD, NSC_DEITY, 0, fldoff(comstr, sell_x), "xsell", EF_BAD},
448 {NSC_YCOORD, NSC_DEITY, 0, fldoff(comstr, sell_y), "ysell", EF_BAD},
449 {NSC_FLOAT, 0, 0, fldoff(comstr, com_price), "price", EF_BAD},
450 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
453 struct castr trade_ca[] = {
454 {NSC_SHORT, 0, 0, fldoff(trdstr, trd_uid), "uid", EF_TRADE},
455 {NSC_NATID, 0, 0, fldoff(trdstr, trd_owner), "owner", EF_NATION},
456 {NSC_CHAR, 0, 0, fldoff(trdstr, trd_type), "type", EF_BAD},
457 {NSC_SHORT, 0, 0, fldoff(trdstr, trd_unitid), "unitid", EF_BAD},
458 {NSC_LONG, 0, 0, fldoff(trdstr, trd_price), "price", EF_BAD},
459 {NSC_INT, 0, 0, fldoff(trdstr, trd_maxbidder), "maxbidder", EF_NATION},
460 {NSC_TIME, 0, 0, fldoff(trdstr, trd_markettime), "markettime", EF_BAD},
461 /* could let the owner access these, but we can't express that yet: */
462 {NSC_XCOORD, NSC_DEITY, 0, fldoff(trdstr, trd_x), "xloc", EF_BAD},
463 {NSC_YCOORD, NSC_DEITY, 0, fldoff(trdstr, trd_y), "yloc", EF_BAD},
464 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
467 struct castr nat_ca[] = {
468 {NSC_NATID, 0, 0, fldoff(natstr, nat_cnum), "cnum", EF_NATION},
469 {NSC_CHAR, NSC_BITS, 0, fldoff(natstr, nat_stat), "stat", EF_BAD},
470 {NSC_STRINGY, 0, 20, fldoff(natstr, nat_cnam), "cname", EF_BAD},
471 {NSC_STRINGY, NSC_DEITY, 20, fldoff(natstr, nat_pnam), "passwd", EF_BAD},
472 {NSC_STRINGY, 0, 32, fldoff(natstr, nat_hostaddr), "ip", EF_BAD},
473 {NSC_STRINGY, 0, 512, fldoff(natstr, nat_hostname), "hostname", EF_BAD},
474 {NSC_STRINGY, 0, 32, fldoff(natstr, nat_userid), "userid", EF_BAD},
475 {NSC_XCOORD, 0, 0, fldoff(natstr, nat_xstart), "xstart", EF_BAD},
476 {NSC_YCOORD, 0, 0, fldoff(natstr, nat_ystart), "ystart", EF_BAD},
477 {NSC_XCOORD, 0, 0, fldoff(natstr, nat_xcap), "xcap", EF_BAD},
478 {NSC_YCOORD, 0, 0, fldoff(natstr, nat_ycap), "ycap", EF_BAD},
479 {NSC_XCOORD, NSC_DEITY, 0, fldoff(natstr, nat_xorg), "xorg", EF_BAD},
480 {NSC_YCOORD, NSC_DEITY, 0, fldoff(natstr, nat_yorg), "yorg", EF_BAD},
481 {NSC_CHAR, 0, 0, fldoff(natstr, nat_update), "update", EF_BAD},
482 {NSC_UCHAR, 0, 0, fldoff(natstr, nat_missed), "missed", EF_BAD},
483 {NSC_USHORT, 0, 0, fldoff(natstr, nat_tgms), "tgms", EF_BAD},
484 {NSC_USHORT, 0, 0, fldoff(natstr, nat_ann), "ann", EF_BAD},
485 {NSC_USHORT, 0, 0, fldoff(natstr, nat_minused), "minused", EF_BAD},
486 {NSC_SHORT, 0, 0, fldoff(natstr, nat_btu), "btu", EF_BAD},
487 {NSC_LONG, 0, 0, fldoff(natstr, nat_reserve), "milreserve", EF_BAD},
488 {NSC_LONG, 0, 0, fldoff(natstr, nat_money), "money", EF_BAD},
489 {NSC_TIME, 0, 0, fldoff(natstr, nat_last_login), "login", EF_BAD},
490 {NSC_TIME, 0, 0, fldoff(natstr, nat_last_logout), "logout", EF_BAD},
491 {NSC_TIME, 0, 0, fldoff(natstr, nat_newstim), "newstim", EF_BAD},
492 {NSC_TIME, 0, 0, fldoff(natstr, nat_annotim), "annotim", EF_BAD},
493 {NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_TLEV]), "tech", EF_BAD},
494 {NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_RLEV]), "research", EF_BAD},
495 {NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_ELEV]), "education",
497 {NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_HLEV]), "happiness",
499 /* FIXME nat_b[], nat_relate[], nat_contact[], nat_rejects[], nat_priorities[] */
500 {NSC_LONG, NSC_BITS, 0, fldoff(natstr, nat_flags),"flags", EF_BAD},
501 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
504 struct castr intrchr_ca[] = {
505 {NSC_STRING, NSC_CONST, 0, offsetof(struct sctintrins, in_name), "name",
507 {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_lcms), "lcms", EF_BAD},
508 {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_hcms), "hcms", EF_BAD},
509 {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_dcost), "dcost", EF_BAD},
510 {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_mcost), "mcost", EF_BAD},
511 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
514 struct castr rpt_ca[] = {
515 {NSC_STRING, 0, NUM_RPTS, offsetof(struct rptstr, r_newstory), "newstory",
517 {NSC_INT, 0, 0, offsetof(struct rptstr, r_good_will), "good_will", EF_BAD},
518 {NSC_INT, 0, 0, offsetof(struct rptstr, r_newspage), "newspage", EF_BAD},
519 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
522 struct castr empfile_ca[] = {
523 {NSC_INT, 0, 0, offsetof(struct empfile, uid), "uid", EF_TABLE},
524 {NSC_STRING, 0, 0, offsetof(struct empfile, name), "name", EF_BAD},
525 {NSC_STRING, 0, 0, offsetof(struct empfile, file), "file", EF_BAD},
526 {NSC_INT, NSC_BITS, 0, offsetof(struct empfile, flags), "flags", EF_BAD},
527 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
530 struct castr symbol_ca[] = {
531 {NSC_INT, 0, 0, offsetof(struct symbol, value), "value", EF_BAD},
532 {NSC_STRING, 0, 0, offsetof(struct symbol, name), "name", EF_BAD},
533 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
536 struct symbol ship_chr_flags[] = {
549 {M_SUBT, "sub-torp"},
551 {M_SEMILAND, "semi-land"},
553 {M_SUPPLY, "supply"},
554 {M_ANTIMISSILE, "anti-missile"},
558 struct symbol land_chr_flags[] = {
559 {L_XLIGHT, "xlight"},
560 {L_ENGINEER, "engineer"},
561 {L_SUPPLY, "supply"},
562 {L_SECURITY, "security"},
564 {L_MARINE, "marine"},
567 {L_ASSAULT, "assault"},
575 struct symbol plane_chr_flags[] = {
588 {P_H, "half-stealth"},
600 struct symbol nuke_chr_flags[] = {
605 struct castr mdchr_ca[] = {
606 {NSC_STRING, 0, 0, offsetof(struct castr, ca_name), "name", EF_BAD},
607 {NSC_CHAR, 0, 0, offsetof(struct castr, ca_type), "type", EF_META_TYPE},
608 {NSC_UCHAR, NSC_BITS, 0, offsetof(struct castr, ca_flags), "flags",
610 {NSC_USHORT, 0, 0, offsetof(struct castr, ca_len), "len", EF_BAD},
611 {NSC_INT, 0, 0, offsetof(struct castr, ca_table), "table", EF_BAD},
612 {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
615 struct symbol meta_flags[] = {
616 {NSC_DEITY, "deity"},
617 {NSC_EXTRA, "extra"},
618 {NSC_CONST, "const"},
623 struct symbol meta_type[] = {