]> git.pond.sub.org Git - empserver/blob - src/lib/global/nsc.c
(sect_ca): Make selectors xloc, yloc NSC_CONST.
[empserver] / src / lib / global / nsc.c
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
4  *                           Ken Stevens, Steve McClure
5  *
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.
10  *
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.
15  *
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
19  *
20  *  ---
21  *
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.
25  *
26  *  ---
27  *
28  *  nsc.c: Empire selection global structures
29  * 
30  *  Known contributors to this file:
31  *     Markus Armbruster, 2004-2006
32  *  
33  */
34
35 /*
36  * Convention: uid selector comes first.  Table TYPE has an uid
37  * selector if empfile[TYPE].cadef[0].ca_table == TYPE.
38  */
39
40 #include <config.h>
41
42 #include <stddef.h>
43 #include "misc.h"
44 #include "xy.h"
45 #include "loan.h"
46 #include "nsc.h"
47 #include "news.h"
48 #include "nuke.h"
49 #include "plane.h"
50 #include "ship.h"
51 #include "land.h"
52 #include "sect.h"
53 #include "trade.h"
54 #include "treaty.h"
55 #include "genitem.h"
56 #include "nat.h"
57 #include "map.h"
58 #include "commodity.h"
59 #include "lost.h"
60 #include "product.h"
61 #include "file.h"
62 #include "mission.h"
63 #include "plague.h"
64
65 #define fldoff(str, fld) offsetof(struct str, fld)
66
67 #define NSC_IELT(name, pfx, sfx, base, itype)           \
68 {NSC_SHORT, 0, 0, ((base) + (itype)*sizeof(u_short)),   \
69 sizeof(sfx) == 1 ? name : pfx sfx, EF_BAD}
70
71 #define NSC_IVEC(base, sfx)             \
72 NSC_IELT("civil", "c", sfx, base, I_CIVIL),     \
73 NSC_IELT("milit", "m", sfx, base, I_MILIT),     \
74 NSC_IELT("shell", "s", sfx, base, I_SHELL),     \
75 NSC_IELT("gun", "g", sfx, base, I_GUN),         \
76 NSC_IELT("petrol", "p", sfx, base, I_PETROL),   \
77 NSC_IELT("iron", "i", sfx, base, I_IRON),       \
78 NSC_IELT("dust", "d", sfx, base, I_DUST),       \
79 NSC_IELT("bar", "b", sfx, base, I_BAR),         \
80 NSC_IELT("food", "f", sfx, base, I_FOOD),       \
81 NSC_IELT("oil", "o", sfx, base, I_OIL),         \
82 NSC_IELT("lcm", "l", sfx, base, I_LCM),         \
83 NSC_IELT("hcm", "h", sfx, base, I_HCM),         \
84 NSC_IELT("uw", "u", sfx, base, I_UW),           \
85 NSC_IELT("rad", "r", sfx, base, I_RAD)
86
87 struct castr ichr_ca[] = {
88     {NSC_SITYPE(i_type), 0, 0, offsetof(struct ichrstr, i_vtype), "vtype",
89      EF_ITEM},
90     {NSC_STRING, 0, 0, offsetof(struct ichrstr, i_name), "name", EF_BAD},
91     {NSC_STRINGY, NSC_CONST, 1, offsetof(struct ichrstr, i_mnem), "mnem",
92      EF_BAD},
93     {NSC_INT, 0, 0, offsetof(struct ichrstr, i_value), "value", EF_BAD},
94     {NSC_INT, 0, 0, offsetof(struct ichrstr, i_sell), "sell", EF_BAD},
95     {NSC_INT, 0, 0, offsetof(struct ichrstr, i_lbs), "lbs", EF_BAD},
96     {NSC_INT, 0, NUMPKG, offsetof(struct ichrstr, i_pkg), "pkg", EF_BAD},
97     {NSC_INT, 0, 0, offsetof(struct ichrstr, i_melt_denom), "melt_denom",
98      EF_BAD},
99     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
100 };
101
102 struct castr pchr_ca[] = {
103     {NSC_INT, 0, 0, offsetof(struct pchrstr, p_uid), "uid", EF_PRODUCT},
104     {NSC_STRING, 0, 0, offsetof(struct pchrstr, p_name), "name", EF_BAD},
105     {NSC_STRING, NSC_CONST, 0, offsetof(struct pchrstr, p_sname), "sname",
106      EF_BAD},
107     {NSC_SITYPE(i_type), 0, MAXPRCON, offsetof(struct pchrstr, p_ctype),
108      "ctype", EF_ITEM},
109     {NSC_USHORT, 0, MAXPRCON, offsetof(struct pchrstr, p_camt), "camt",
110      EF_BAD},
111     {NSC_SITYPE(i_type), 0, 0, offsetof(struct pchrstr, p_type), "type",
112      EF_ITEM},
113     {NSC_INT, 0, 0, offsetof(struct pchrstr, p_level), "level", EF_LEVEL},
114     {NSC_INT, 0, 0, offsetof(struct pchrstr, p_cost), "cost", EF_BAD},
115     {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nrndx), "nrndx", EF_RESOURCES},
116     {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nrdep), "nrdep", EF_BAD},
117     {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nlndx), "nlndx", EF_LEVEL},
118     {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nlmin), "nlmin", EF_BAD},
119     {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nllag), "nllag", EF_BAD},
120     {NSC_INT, 0, 0, offsetof(struct pchrstr, p_effic), "effic", EF_BAD},
121     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
122 };
123
124 struct castr sect_ca[] = {
125     /* uid is encoded in x, y */
126     {NSC_NATID, 0, 0, fldoff(sctstr, sct_own), "owner", EF_NATION},
127     {NSC_XCOORD, NSC_CONST, 0, fldoff(sctstr, sct_x), "xloc", EF_BAD},
128     {NSC_YCOORD, NSC_CONST, 0, fldoff(sctstr, sct_y), "yloc", EF_BAD},
129     {NSC_TYPEID, 0, 0, fldoff(sctstr, sct_type), "des", EF_SECTOR_CHR},
130     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_effic), "effic", EF_BAD},
131     {NSC_SHORT, 0, 0, fldoff(sctstr, sct_mobil), "mobil", EF_BAD},
132     {NSC_UCHAR, NSC_DEITY, 0, fldoff(sctstr, sct_loyal), "loyal", EF_BAD},
133     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr), "terr", EF_BAD},
134     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(sctstr, sct_terr), "terr0", EF_BAD},
135     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr1), "terr1", EF_BAD},
136     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr2), "terr2", EF_BAD},
137     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr3), "terr3", EF_BAD},
138     {NSC_XCOORD, 0, 0, fldoff(sctstr, sct_dist_x), "xdist", EF_BAD},
139     {NSC_YCOORD, 0, 0, fldoff(sctstr, sct_dist_y), "ydist", EF_BAD},
140     {NSC_SHORT, 0, 0, fldoff(sctstr, sct_avail), "avail", EF_BAD},
141     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_work), "work", EF_BAD},
142     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_coastal), "coastal", EF_BAD},
143     {NSC_TYPEID, 0, 0, fldoff(sctstr, sct_newtype), "newdes", EF_SECTOR_CHR},
144     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_min), "min", EF_BAD},
145     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_gmin), "gold", EF_BAD},
146     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_fertil), "fert", EF_BAD},
147     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_oil), "ocontent", EF_BAD},
148     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_uran), "uran", EF_BAD},
149     {NSC_NATID, 0, 0, fldoff(sctstr, sct_oldown), "oldown", EF_NATION},
150     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_off), "off", EF_BAD},
151     NSC_IVEC(fldoff(sctstr, sct_item), ""),
152     NSC_IVEC(fldoff(sctstr, sct_dist), "_dist"),
153     NSC_IVEC(fldoff(sctstr, sct_del), "_del"),
154     {NSC_SHORT, NSC_DEITY, 0, fldoff(sctstr, sct_mines), "mines", EF_BAD},
155     {NSC_SHORT, NSC_DEITY, 0, fldoff(sctstr, sct_pstage), "pstage",
156      EF_PLAGUE_STAGES},
157     {NSC_SHORT, NSC_DEITY, 0, fldoff(sctstr, sct_ptime), "ptime", EF_BAD},
158     {NSC_UCHAR, NSC_DEITY, 0, fldoff(sctstr, sct_che), "che", EF_BAD},
159     {NSC_NATID, NSC_DEITY, 0, fldoff(sctstr, sct_che_target), "che_target",
160      EF_NATION},
161     {NSC_USHORT, 0, 0, fldoff(sctstr, sct_fallout), "fallout", EF_BAD},
162     {NSC_TIME, 0, 0, fldoff(sctstr, sct_access), "access", EF_BAD},
163     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_road), "road", EF_BAD},
164     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_rail), "rail", EF_BAD},
165     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_defense), "dfense", EF_BAD},
166     {NSC_TIME, NSC_EXTRA, 0, fldoff(sctstr, sct_timestamp), "timestamp",
167      EF_BAD},
168     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
169 };
170
171 struct castr dchr_ca[] = {
172     {NSC_UCHAR, 0, 0, offsetof(struct dchrstr, d_uid), "uid", EF_SECTOR_CHR},
173     {NSC_STRING, 0, 0, offsetof(struct dchrstr, d_name), "name", EF_BAD},
174     {NSC_STRINGY, NSC_CONST, 1, offsetof(struct dchrstr, d_mnem), "mnem",
175      EF_BAD},
176     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_prd), "prd", EF_PRODUCT},
177     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_mcst), "mcst", EF_BAD},
178     {NSC_SITYPE(d_navigation), 0, 0, offsetof(struct dchrstr, d_nav), "nav",
179      EF_SECTOR_NAVIGATION},
180     {NSC_SITYPE(i_packing), 0, 0, offsetof(struct dchrstr, d_pkg), "pkg",
181      EF_PACKING},
182     {NSC_FLOAT, 0, 0, offsetof(struct dchrstr, d_ostr), "ostr", EF_BAD},
183     {NSC_FLOAT, 0, 0, offsetof(struct dchrstr, d_dstr), "dstr", EF_BAD},
184     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_value), "value", EF_BAD},
185     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_cost), "cost", EF_BAD},
186     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_build), "build", EF_BAD},
187     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_lcms), "lcms", EF_BAD},
188     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_hcms), "hcms", EF_BAD},
189     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_maxpop), "maxpop", EF_BAD},
190     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
191 };
192
193 #define NSC_GENITEM(ef_type, ef_chr)                                    \
194 { NSC_SHORT, 0, 0, fldoff(genitem, uid), "uid", ef_type},               \
195 { NSC_NATID, 0, 0, fldoff(genitem, own), "owner", EF_NATION},           \
196 { NSC_XCOORD, 0, 0, fldoff(genitem, x), "xloc", EF_BAD},                \
197 { NSC_YCOORD, 0, 0, fldoff(genitem, y), "yloc", EF_BAD},                \
198 { NSC_TYPEID, 0, 0, fldoff(genitem, type), "type", ef_chr},             \
199 { NSC_CHAR, 0, 0, fldoff(genitem, effic), "effic", EF_BAD},             \
200 { NSC_CHAR , 0, 0, fldoff(genitem, mobil), "mobil", EF_BAD},            \
201 { NSC_SHORT, 0, 0, fldoff(genitem, tech), "tech", EF_BAD},              \
202 { NSC_CHAR, NSC_EXTRA, 0, fldoff(genitem, group), "group", EF_BAD},     \
203 { NSC_XCOORD, 0, 0, fldoff(genitem, opx), "opx", EF_BAD},               \
204 { NSC_YCOORD, 0, 0, fldoff(genitem, opy), "opy", EF_BAD},               \
205 { NSC_SHORT, 0, 0, fldoff(genitem, mission), "mission", EF_MISSIONS},   \
206 { NSC_SHORT, 0, 0, fldoff(genitem, radius), "radius", EF_BAD}
207
208 struct castr ship_ca[] = {
209     NSC_GENITEM(EF_SHIP, EF_SHIP_CHR),
210     {NSC_CHAR, 0, 0, fldoff(shpstr, shp_fleet), "fleet", EF_BAD},
211     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(shpstr, shp_nplane), "nplane", EF_BAD},
212     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(shpstr, shp_nland), "nland", EF_BAD},
213     {NSC_XCOORD, 0, 0, fldoff(shpstr, shp_destx[0]), "xstart", EF_BAD},
214     {NSC_XCOORD, 0, 0, fldoff(shpstr, shp_destx[1]), "xend", EF_BAD},
215     {NSC_YCOORD, 0, 0, fldoff(shpstr, shp_desty[0]), "ystart", EF_BAD},
216     {NSC_YCOORD, 0, 0, fldoff(shpstr, shp_desty[1]), "yend", EF_BAD},
217     {NSC_SITYPE(i_type), 0, TMAX, fldoff(shpstr, shp_tstart), "cargostart",
218      EF_ITEM},
219     {NSC_SITYPE(i_type), 0, TMAX, fldoff(shpstr, shp_tend), "cargoend",
220      EF_ITEM},
221     {NSC_SHORT, 0, TMAX, fldoff(shpstr, shp_lstart), "amtstart", EF_BAD},
222     {NSC_SHORT, 0, TMAX, fldoff(shpstr, shp_lend), "amtend", EF_BAD},
223     {NSC_UCHAR, 0, 0, fldoff(shpstr, shp_autonav), "autonav", EF_BAD},
224     NSC_IVEC(fldoff(shpstr, shp_item), ""),
225     {NSC_SHORT, NSC_DEITY, 0, fldoff(shpstr, shp_pstage), "pstage",
226      EF_PLAGUE_STAGES},
227     {NSC_SHORT, NSC_DEITY, 0, fldoff(shpstr, shp_ptime), "ptime", EF_BAD},
228     {NSC_TIME, 0, 0, fldoff(shpstr, shp_access), "access", EF_BAD},
229     {NSC_TIME, NSC_EXTRA, 0, fldoff(shpstr, shp_timestamp), "timestamp",
230      EF_BAD},
231     {NSC_UCHAR, 0, 0, fldoff(shpstr, shp_mobquota), "mquota", EF_BAD},
232     {NSC_STRINGY, 0, MAXSHPPATH, fldoff(shpstr, shp_path), "path", EF_BAD},
233     {NSC_SHORT, 0, 0, fldoff(shpstr, shp_follow), "follow", EF_BAD},
234     {NSC_STRINGY, 0, MAXSHPNAMLEN, fldoff(shpstr, shp_name), "name", EF_BAD},
235     {NSC_UCHAR, 0, 0, fldoff(shpstr, shp_fuel), "fuel", EF_BAD},
236     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(shpstr, shp_nchoppers), "nchoppers",
237      EF_BAD},
238     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(shpstr, shp_nxlight), "nxlight", EF_BAD},
239     /* could let builder access these, but we can't express that yet: */
240     {NSC_XCOORD, NSC_DEITY, 0, fldoff(shpstr, shp_orig_x), "xbuilt", EF_BAD},
241     {NSC_YCOORD, NSC_DEITY, 0, fldoff(shpstr, shp_orig_y), "ybuilt", EF_BAD},
242     {NSC_NATID, NSC_DEITY, 0, fldoff(shpstr, shp_orig_own), "builder",
243      EF_NATION},
244     {NSC_INT, NSC_BITS, 0, fldoff(shpstr, shp_rflags), "rflags",
245      EF_RETREAT_FLAGS},
246     {NSC_STRINGY, 0, RET_LEN, fldoff(shpstr, shp_rpath), "rpath", EF_BAD},
247     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
248 };
249
250 struct castr mchr_ca[] = {
251     /* FIXME uid */
252     {NSC_STRING, 0, 0, offsetof(struct mchrstr, m_name), "name", EF_BAD},
253     NSC_IVEC(offsetof(struct mchrstr, m_item), ""),
254     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_lcm), "l_build", EF_BAD},
255     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_hcm), "h_build", EF_BAD},
256     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_armor), "armor", EF_BAD},
257     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_speed), "speed", EF_BAD},
258     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_visib), "visib", EF_BAD},
259     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_vrnge), "vrnge", EF_BAD},
260     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_frnge), "frnge", EF_BAD},
261     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_glim), "glim", EF_BAD},
262     {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_nxlight), "nxlight", EF_BAD},
263     {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_nchoppers), "nchoppers",
264      EF_BAD},
265     {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_fuelc), "fuelc", EF_BAD},
266     {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_fuelu), "fuelu", EF_BAD},
267     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_tech), "tech", EF_BAD},
268     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_cost), "cost", EF_BAD},
269     {NSC_LONG, NSC_BITS, 0, offsetof(struct mchrstr, m_flags), "flags",
270      EF_SHIP_CHR_FLAGS},
271     {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_nplanes), "nplanes", EF_BAD},
272     {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_nland), "nland", EF_BAD},
273     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
274 };
275
276 struct castr plane_ca[] = {
277     NSC_GENITEM(EF_PLANE, EF_PLANE_CHR),
278     {NSC_CHAR, 0, 0, fldoff(plnstr, pln_wing), "wing", EF_BAD},
279     {NSC_UCHAR, 0, 0, fldoff(plnstr, pln_range), "range", EF_BAD},
280     {NSC_SHORT, 0, 0, fldoff(plnstr, pln_ship), "ship", EF_BAD},
281     {NSC_SHORT, 0, 0, fldoff(plnstr, pln_land), "land", EF_BAD},
282     {NSC_INT, NSC_EXTRA, 0, fldoff(plnstr, pln_att), "att", EF_BAD},
283     {NSC_INT, NSC_EXTRA, 0, fldoff(plnstr, pln_def), "def", EF_BAD},
284     {NSC_CHAR, 0, 0, fldoff(plnstr, pln_harden), "harden", EF_BAD},
285     {NSC_CHAR, 0, 0, fldoff(plnstr, pln_nuketype), "nuketype", EF_BAD},
286     {NSC_CHAR, NSC_BITS, 0, fldoff(plnstr, pln_flags), "flags",
287      EF_PLANE_FLAGS},
288     {NSC_TIME, 0, 0, fldoff(plnstr, pln_access), "access", EF_BAD},
289     {NSC_TIME, NSC_EXTRA, 0, fldoff(plnstr, pln_timestamp), "timestamp",
290      EF_BAD},
291     {NSC_FLOAT, 0, 0, fldoff(plnstr, pln_theta), "theta", EF_BAD},
292     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
293 };
294
295 struct castr plchr_ca[] = {
296     /* FIXME uid */
297     {NSC_STRING, 0, 0, offsetof(struct plchrstr, pl_name), "name", EF_BAD},
298     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_lcm), "l_build", EF_BAD},
299     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_hcm), "h_build", EF_BAD},
300     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_cost), "cost", EF_BAD},
301     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_tech), "tech", EF_BAD},
302     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_acc), "acc", EF_BAD},
303     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_load), "load", EF_BAD},
304     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_att), "att", EF_BAD},
305     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_def), "def", EF_BAD},
306     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_range), "range", EF_BAD},
307     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_crew), "crew", EF_BAD},
308     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_fuel), "fuel", EF_BAD},
309     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_stealth), "stealth", EF_BAD},
310     {NSC_INT, NSC_BITS, 0, offsetof(struct plchrstr, pl_flags), "flags",
311      EF_PLANE_CHR_FLAGS},
312     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
313 };
314
315 struct castr land_ca[] = {
316     NSC_GENITEM(EF_LAND, EF_LAND_CHR),
317     {NSC_CHAR, 0, 0, fldoff(lndstr, lnd_army), "army", EF_BAD},
318     {NSC_SHORT, 0, 0, fldoff(lndstr, lnd_ship), "ship", EF_BAD},
319     {NSC_CHAR, 0, 0, fldoff(lndstr, lnd_harden), "harden", EF_BAD},
320     {NSC_SHORT, 0, 0, fldoff(lndstr, lnd_retreat), "retreat", EF_BAD},
321     {NSC_UCHAR, 0, 0, fldoff(lndstr, lnd_fuel), "fuel", EF_BAD},
322     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_nxlight), "nxlight", EF_BAD},
323     {NSC_INT, NSC_BITS, 0, fldoff(lndstr, lnd_rflags), "rflags",
324      EF_RETREAT_FLAGS},
325     {NSC_STRINGY, 0, RET_LEN, fldoff(lndstr, lnd_rpath), "rpath", EF_BAD},
326     {NSC_UCHAR, 0, 0, fldoff(lndstr, lnd_rad_max), "react", EF_BAD},
327     NSC_IVEC(fldoff(lndstr, lnd_item), ""),
328     {NSC_SHORT, NSC_DEITY, 0, fldoff(lndstr, lnd_pstage), "pstage",
329      EF_PLAGUE_STAGES},
330     {NSC_SHORT, NSC_DEITY, 0, fldoff(lndstr, lnd_ptime), "ptime", EF_BAD},
331     {NSC_SHORT, 0, 0, fldoff(lndstr, lnd_land), "land", EF_BAD},
332     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_nland), "nland", EF_BAD},
333     {NSC_TIME, 0, 0, fldoff(lndstr, lnd_access), "access", EF_BAD},
334     {NSC_FLOAT, NSC_EXTRA, 0, fldoff(lndstr, lnd_att), "att", EF_BAD},
335     {NSC_FLOAT, NSC_EXTRA, 0, fldoff(lndstr, lnd_def), "def", EF_BAD},
336     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_vul), "vul", EF_BAD},
337     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_spd), "spd", EF_BAD},
338     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_vis), "vis", EF_BAD},
339     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_spy), "spy", EF_BAD},
340     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_rad), "rmax", EF_BAD},
341     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_frg), "frg", EF_BAD},
342     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_acc), "acc", EF_BAD},
343     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_dam), "dam", EF_BAD},
344     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_ammo), "ammo", EF_BAD},
345     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_aaf), "aaf", EF_BAD},
346     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_fuelc), "fuelc", EF_BAD},
347     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_fuelu), "fuelu", EF_BAD},
348     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_maxlight), "maxlight",
349      EF_BAD},
350     {NSC_TIME, NSC_EXTRA, 0, fldoff(lndstr, lnd_timestamp), "timestamp",
351      EF_BAD},
352     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
353 };
354
355 struct castr lchr_ca[] = {
356     /* FIXME uid */
357     {NSC_STRING, 0, 0, offsetof(struct lchrstr, l_name), "name", EF_BAD},
358     NSC_IVEC(offsetof(struct lchrstr, l_item), ""),
359     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_lcm), "l_build", EF_BAD},
360     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_hcm), "h_build", EF_BAD},
361     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_gun), "g_build", EF_BAD},
362     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_shell), "s_build", EF_BAD},
363     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_tech), "tech", EF_BAD},
364     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_cost), "cost", EF_BAD},
365     {NSC_FLOAT, 0, 0, offsetof(struct lchrstr, l_att), "att", EF_BAD},
366     {NSC_FLOAT, 0, 0, offsetof(struct lchrstr, l_def), "def", EF_BAD},
367     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_vul), "vul", EF_BAD},
368     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_spd), "spd", EF_BAD},
369     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_vis), "vis", EF_BAD},
370     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_spy), "spy", EF_BAD},
371     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_rad), "rmax", EF_BAD},
372     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_frg), "frg", EF_BAD},
373     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_acc), "acc", EF_BAD},
374     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_dam), "dam", EF_BAD},
375     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_ammo), "ammo", EF_BAD},
376     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_aaf), "aaf", EF_BAD},
377     {NSC_UCHAR, 0, 0, offsetof(struct lchrstr, l_fuelc), "fuelc", EF_BAD},
378     {NSC_UCHAR, 0, 0, offsetof(struct lchrstr, l_fuelu), "fuelu", EF_BAD},
379     {NSC_UCHAR, 0, 0, offsetof(struct lchrstr, l_nxlight), "nxlight", EF_BAD},
380     {NSC_UCHAR, 0, 0, offsetof(struct lchrstr, l_mxland), "mxland", EF_BAD},
381     {NSC_LONG, NSC_BITS, 0, offsetof(struct lchrstr, l_flags), "flags",
382      EF_LAND_CHR_FLAGS},
383     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
384 };
385
386 struct castr nuke_ca[] = {
387     {NSC_SHORT, 0, 0, fldoff(nukstr, nuk_uid), "uid", EF_NUKE},
388     {NSC_NATID, 0, 0, fldoff(nukstr, nuk_own), "owner", EF_NATION},
389     {NSC_XCOORD, 0, 0, fldoff(nukstr, nuk_x), "xloc", EF_BAD},
390     {NSC_YCOORD, 0, 0, fldoff(nukstr, nuk_y), "yloc", EF_BAD},
391     {NSC_CHAR, 0, 0, fldoff(nukstr, nuk_n), "number", EF_BAD},
392     {NSC_SHORT, 0, N_MAXNUKE, fldoff(nukstr, nuk_types), "types", EF_BAD},
393     {NSC_TIME, NSC_EXTRA, 0, fldoff(nukstr, nuk_timestamp), "timestamp",
394      EF_BAD},
395     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
396 };
397
398 struct castr nchr_ca[] = {
399     /* FIXME uid */
400     {NSC_STRING, 0, 0, offsetof(struct nchrstr, n_name), "name", EF_BAD},
401     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_lcm), "l_build", EF_BAD},
402     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_hcm), "h_build", EF_BAD},
403     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_oil), "o_build", EF_BAD},
404     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_rad), "r_build", EF_BAD},
405     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_blast), "blast", EF_BAD},
406     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_dam), "dam", EF_BAD},
407     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_cost), "cost", EF_BAD},
408     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_tech), "tech", EF_BAD},
409     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_weight), "weight", EF_BAD},
410     {NSC_INT, NSC_BITS, 0, offsetof(struct nchrstr, n_flags), "flags",
411      EF_NUKE_CHR_FLAGS},
412     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
413 };
414
415 struct castr treaty_ca[] = {
416     {NSC_SHORT, 0, 0, fldoff(trtstr, trt_uid), "uid", EF_TREATY},
417     {NSC_NATID, 0, 0, fldoff(trtstr, trt_cna), "cna", EF_NATION},
418     {NSC_NATID, 0, 0, fldoff(trtstr, trt_cnb), "cnb", EF_NATION},
419     {NSC_CHAR, 0, 0, fldoff(trtstr, trt_status), "status",
420      EF_AGREEMENT_STATUS},
421     {NSC_SHORT, NSC_BITS, 0, fldoff(trtstr, trt_acond), "acond",
422      EF_TREATY_FLAGS},
423     {NSC_SHORT, NSC_BITS, 0, fldoff(trtstr, trt_bcond), "bcond",
424      EF_TREATY_FLAGS},
425     {NSC_TIME, 0, 0, fldoff(trtstr, trt_exp), "exp", EF_BAD},
426     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
427 };
428
429 struct castr loan_ca[] = {
430     {NSC_SHORT, 0, 0, fldoff(lonstr, l_uid), "uid", EF_LOAN},
431     {NSC_NATID, 0, 0, fldoff(lonstr, l_loner), "loaner", EF_NATION},
432     {NSC_NATID, 0, 0, fldoff(lonstr, l_lonee), "loanee", EF_NATION},
433     {NSC_CHAR, 0, 0, fldoff(lonstr, l_status), "status",
434      EF_AGREEMENT_STATUS},
435     {NSC_INT, 0, 0, fldoff(lonstr, l_irate), "irate", EF_BAD},
436     {NSC_INT, 0, 0, fldoff(lonstr, l_ldur), "ldur", EF_BAD},
437     {NSC_LONG, 0, 0, fldoff(lonstr, l_amtpaid), "amtpaid", EF_BAD},
438     {NSC_LONG, 0, 0, fldoff(lonstr, l_amtdue), "amtdue", EF_BAD},
439     {NSC_TIME, 0, 0, fldoff(lonstr, l_lastpay), "lastpay", EF_BAD},
440     {NSC_TIME, 0, 0, fldoff(lonstr, l_duedate), "duedate", EF_BAD},
441     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
442 };
443
444 struct castr news_ca[] = {
445     /* no need for uid as long as it's not referenced from other tables */
446     {NSC_NATID, 0, 0, fldoff(nwsstr, nws_ano), "actor", EF_NATION},
447     {NSC_CHAR, 0, 0, fldoff(nwsstr, nws_vrb), "action", EF_NEWS_CHR},
448     {NSC_NATID, 0, 0, fldoff(nwsstr, nws_vno), "victim", EF_NATION},
449     {NSC_CHAR, 0, 0, fldoff(nwsstr, nws_ntm), "times", EF_BAD},
450     {NSC_TIME, 0, 0, fldoff(nwsstr, nws_when), "time", EF_BAD},
451     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
452 };
453
454 struct castr lost_ca[] = {
455     /* no need for uid as long as it's not referenced from other tables */
456     {NSC_NATID, 0, 0, fldoff(loststr, lost_owner), "owner", EF_NATION},
457     {NSC_CHAR, 0, 0, fldoff(loststr, lost_type), "type", EF_BAD},
458     {NSC_SHORT, 0, 0, fldoff(loststr, lost_id), "id", EF_BAD},
459     {NSC_XCOORD, 0, 0, fldoff(loststr, lost_x), "x", EF_BAD},
460     {NSC_YCOORD, 0, 0, fldoff(loststr, lost_y), "y", EF_BAD},
461     {NSC_TIME, 0, 0, fldoff(loststr, lost_timestamp), "timestamp", EF_BAD},
462     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
463 };
464
465 struct castr commodity_ca[] = {
466     {NSC_SHORT, 0, 0, fldoff(comstr, com_uid), "uid", EF_COMM},
467     {NSC_NATID, 0, 0, fldoff(comstr, com_owner), "owner", EF_NATION},
468     {NSC_SITYPE(i_type), 0, 0, fldoff(comstr, com_type), "type", EF_ITEM},
469     {NSC_INT, 0, 0, fldoff(comstr, com_amount), "amount", EF_BAD},
470     {NSC_FLOAT, 0, 0, fldoff(comstr, com_price), "price", EF_BAD},
471     {NSC_INT, 0, 0, fldoff(comstr, com_maxbidder), "maxbidder", EF_NATION},
472     {NSC_TIME, 0, 0, fldoff(comstr, com_markettime), "markettime", EF_BAD},
473     /* could let maxbidder access these, but we can't express that yet: */
474     {NSC_XCOORD, NSC_DEITY, 0, fldoff(comstr, com_x), "xbuy", EF_BAD},
475     {NSC_XCOORD, NSC_DEITY, 0, fldoff(comstr, com_y), "ybuy", EF_BAD},
476     /* could let the owner access these, but we can't express that yet: */
477     {NSC_XCOORD, NSC_DEITY, 0, fldoff(comstr, sell_x), "xsell", EF_BAD},
478     {NSC_YCOORD, NSC_DEITY, 0, fldoff(comstr, sell_y), "ysell", EF_BAD},
479     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
480 };
481
482 struct castr trade_ca[] = {
483     {NSC_SHORT, 0, 0, fldoff(trdstr, trd_uid), "uid", EF_TRADE},
484     {NSC_NATID, 0, 0, fldoff(trdstr, trd_owner), "owner", EF_NATION},
485     {NSC_CHAR, 0, 0, fldoff(trdstr, trd_type), "type", EF_BAD},
486     {NSC_SHORT, 0, 0, fldoff(trdstr, trd_unitid), "unitid", EF_BAD},
487     {NSC_LONG, 0, 0, fldoff(trdstr, trd_price), "price", EF_BAD},
488     {NSC_INT, 0, 0, fldoff(trdstr, trd_maxbidder), "maxbidder", EF_NATION},
489     {NSC_TIME, 0, 0, fldoff(trdstr, trd_markettime), "markettime", EF_BAD},
490     /* could let the maxbidder access these, but we can't express that yet: */
491     {NSC_XCOORD, NSC_DEITY, 0, fldoff(trdstr, trd_x), "xloc", EF_BAD},
492     {NSC_YCOORD, NSC_DEITY, 0, fldoff(trdstr, trd_y), "yloc", EF_BAD},
493     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
494 };
495
496 struct castr nat_ca[] = {
497     {NSC_NATID, 0, 0, fldoff(natstr, nat_cnum), "cnum", EF_NATION},
498     {NSC_SITYPE(nat_status), 0, 0, fldoff(natstr, nat_stat), "stat",
499      EF_NATION_STATUS},
500     {NSC_STRINGY, 0, 20, fldoff(natstr, nat_cnam), "cname", EF_BAD},
501     {NSC_STRINGY, NSC_DEITY, 20, fldoff(natstr, nat_pnam), "passwd", EF_BAD},
502     {NSC_STRINGY, 0, 32, fldoff(natstr, nat_hostaddr), "ip", EF_BAD},
503     {NSC_STRINGY, 0, 512, fldoff(natstr, nat_hostname), "hostname", EF_BAD},
504     {NSC_STRINGY, 0, 32, fldoff(natstr, nat_userid), "userid", EF_BAD},
505     {NSC_XCOORD, 0, 0, fldoff(natstr, nat_xcap), "xcap", EF_BAD},
506     {NSC_YCOORD, 0, 0, fldoff(natstr, nat_ycap), "ycap", EF_BAD},
507     {NSC_XCOORD, NSC_DEITY, 0, fldoff(natstr, nat_xorg), "xorg", EF_BAD},
508     {NSC_YCOORD, NSC_DEITY, 0, fldoff(natstr, nat_yorg), "yorg", EF_BAD},
509     {NSC_CHAR, 0, 0, fldoff(natstr, nat_dayno), "dayno", EF_BAD},
510     {NSC_CHAR, 0, 0, fldoff(natstr, nat_update), "update", EF_BAD},
511     {NSC_UCHAR, 0, 0, fldoff(natstr, nat_missed), "missed", EF_BAD},
512     {NSC_USHORT, 0, 0, fldoff(natstr, nat_tgms), "tgms", EF_BAD},
513     {NSC_USHORT, 0, 0, fldoff(natstr, nat_ann), "ann", EF_BAD},
514     {NSC_USHORT, 0, 0, fldoff(natstr, nat_minused), "minused", EF_BAD},
515     {NSC_SHORT, 0, 0, fldoff(natstr, nat_btu), "btu", EF_BAD},
516     {NSC_LONG, 0, 0, fldoff(natstr, nat_reserve), "milreserve", EF_BAD},
517     {NSC_LONG, 0, 0, fldoff(natstr, nat_money), "money", EF_BAD},
518     {NSC_TIME, 0, 0, fldoff(natstr, nat_last_login), "login", EF_BAD},
519     {NSC_TIME, 0, 0, fldoff(natstr, nat_last_logout), "logout", EF_BAD},
520     {NSC_TIME, 0, 0, fldoff(natstr, nat_newstim), "newstim", EF_BAD},
521     {NSC_TIME, 0, 0, fldoff(natstr, nat_annotim), "annotim", EF_BAD},
522     {NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_TLEV]), "tech", EF_BAD},
523     {NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_RLEV]), "research", EF_BAD},
524     {NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_ELEV]), "education",
525      EF_BAD},
526     {NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_HLEV]), "happiness",
527      EF_BAD},
528     {NSC_SHORT, 0, MAXNOC, fldoff(natstr, nat_relate), "relations",
529      EF_NATION_RELATIONS},
530     {NSC_UCHAR, NSC_DEITY, MAXNOC, fldoff(natstr, nat_contact), "contacts",
531      EF_BAD},
532     /* FIXME nat_rejects[], nat_priorities[] */
533     {NSC_LONG, NSC_BITS, 0, fldoff(natstr, nat_flags), "flags",
534      EF_NATION_FLAGS},
535     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
536 };
537
538 struct castr cou_ca[] = {
539     {NSC_NATID, NSC_CONST, 0, fldoff(natstr, nat_cnum), "cnum", EF_NATION},
540     {NSC_SITYPE(nat_status), NSC_CONST, 0, fldoff(natstr, nat_stat), "stat",
541      EF_NATION_STATUS},
542     {NSC_STRINGY, NSC_CONST, 20, fldoff(natstr, nat_cnam), "cname", EF_BAD},
543     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
544 };
545
546 struct castr realm_ca[] = {
547     /* uid is encoded in cnum, realm */
548     {NSC_NATID, NSC_CONST, 0, fldoff(realmstr, r_cnum), "cnum", EF_NATION},
549     {NSC_USHORT, NSC_CONST, 0, fldoff(realmstr, r_realm), "realm", EF_BAD},
550     {NSC_SHORT, 0, 0, fldoff(realmstr, r_xl), "xl", EF_BAD},
551     {NSC_SHORT, 0, 0, fldoff(realmstr, r_xh), "xh", EF_BAD},
552     {NSC_SHORT, 0, 0, fldoff(realmstr, r_yl), "yl", EF_BAD},
553     {NSC_SHORT, 0, 0, fldoff(realmstr, r_yh), "yh", EF_BAD},
554     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
555 };
556
557 struct castr intrchr_ca[] = {
558     /* no need for uid as long as it's not referenced from other tables */
559     {NSC_STRING, NSC_CONST, 0, offsetof(struct sctintrins, in_name), "name",
560      EF_BAD},
561     {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_lcms), "lcms", EF_BAD},
562     {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_hcms), "hcms", EF_BAD},
563     {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_dcost), "dcost", EF_BAD},
564     {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_mcost), "mcost", EF_BAD},
565     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
566 };
567
568 struct castr rpt_ca[] = {
569     {NSC_CHAR, 0, 0, offsetof(struct rptstr, r_uid), "uid", EF_NEWS_CHR},
570     {NSC_STRING, 0, NUM_RPTS, offsetof(struct rptstr, r_newstory), "newstory",
571      EF_BAD},
572     {NSC_INT, 0, 0, offsetof(struct rptstr, r_good_will), "good_will", EF_BAD},
573     {NSC_INT, 0, 0, offsetof(struct rptstr, r_newspage), "newspage",
574      EF_PAGE_HEADINGS},
575     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
576 };
577
578 struct castr empfile_ca[] = {
579     {NSC_INT, 0, 0, offsetof(struct empfile, uid), "uid", EF_TABLE},
580     {NSC_STRING, NSC_CONST, 0, offsetof(struct empfile, name), "name", EF_BAD},
581     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
582 };
583
584 struct castr symbol_ca[] = {
585     /*
586      * value is is const because it has to match what is compiled into
587      * the server.  name is const because clients key on it.
588      */
589     {NSC_INT, NSC_CONST, 0, offsetof(struct symbol, value), "value", EF_BAD},
590     {NSC_STRING, NSC_CONST, 0, offsetof(struct symbol, name), "name", EF_BAD},
591     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
592 };
593
594 struct symbol ship_chr_flags[] = {
595     {M_FOOD, "fish"},
596     {M_TORP, "torp"},
597     {M_DCH, "dchrg"},
598     {M_FLY, "plane"},
599     {M_MSL, "miss"},
600     {M_OIL, "oil"},
601     {M_SONAR, "sonar"},
602     {M_MINE, "mine"},
603     {M_SWEEP, "sweep"},
604     {M_SUB, "sub"},
605     {M_LAND, "land"},
606     {M_SUBT, "sub-torp"},
607     {M_TRADE, "trade"},
608     {M_SEMILAND, "semi-land"},
609     {M_OILER, "oiler"},
610     {M_SUPPLY, "supply"},
611     {M_CANAL, "canal"},
612     {M_ANTIMISSILE, "anti-missile"},
613     {0, NULL}
614 };
615
616 struct symbol land_chr_flags[] = {
617     {L_ENGINEER, "engineer"},
618     {L_SUPPLY, "supply"},
619     {L_SECURITY, "security"},
620     {L_LIGHT, "light"},
621     {L_MARINE, "marine"},
622     {L_RECON, "recon"},
623     {L_RADAR, "radar"},
624     {L_ASSAULT, "assault"},
625     {L_FLAK, "flak"},
626     {L_SPY, "spy"},
627     {L_TRAIN, "train"},
628     {L_HEAVY, "heavy"},
629     {0, NULL}
630 };
631
632 struct symbol plane_chr_flags[] = {
633     {P_T, "tactical"},
634     {P_B, "bomber"},
635     {P_F, "intercept"},
636     {P_C, "cargo"},
637     {P_V, "VTOL"},
638     {P_M, "missile"},
639     {P_L, "light"},
640     {P_S, "spy"},
641     {P_I, "image"},
642     {P_O, "satellite"},
643     {P_X, "stealth"},
644     {P_N, "SDI"},
645     {P_H, "half-stealth"},
646     {P_E, "x-light"},
647     {P_K, "helo"},
648     {P_A, "ASW"},
649     {P_P, "para"},
650     {P_ESC, "escort"},
651     {P_MINE, "mine"},
652     {P_SWEEP, "sweep"},
653     {P_MAR, "marine"},
654     {0, NULL}
655 };
656
657 struct symbol nuke_chr_flags[] = {
658     {N_NEUT, "neutron"},
659     {0, NULL}
660 };
661
662 struct castr mdchr_ca[] = {
663     /* no need for uid */
664     /* name must come first, clients may rely on it */
665     {NSC_STRING, NSC_CONST, 0, offsetof(struct castr, ca_name), "name",
666      EF_BAD},
667     {NSC_CHAR, NSC_CONST, 0, offsetof(struct castr, ca_type), "type",
668      EF_META_TYPE},
669     {NSC_UCHAR, NSC_CONST | NSC_BITS, 0, offsetof(struct castr, ca_flags),
670      "flags", EF_META_FLAGS},
671     {NSC_USHORT, NSC_CONST, 0, offsetof(struct castr, ca_len), "len",
672      EF_BAD},
673     {NSC_INT, NSC_CONST, 0, offsetof(struct castr, ca_table), "table",
674      EF_BAD},
675     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
676 };
677
678 struct symbol meta_flags[] = {
679     {NSC_DEITY, "deity"},
680     {NSC_EXTRA, "extra"},
681     {NSC_CONST, "const"},
682     {NSC_BITS, "bits"},
683     {0, NULL}
684 };
685
686 struct symbol meta_type[]  = {
687     {NSC_LONG, "d"},
688     {NSC_DOUBLE, "g"},
689     {NSC_STRING, "s"},
690     {NSC_TYPEID, "d"},
691     {NSC_CHAR, "d"},
692     {NSC_UCHAR, "d"},
693     {NSC_SHORT, "d"},
694     {NSC_USHORT, "d"},
695     {NSC_INT, "d"},
696     {NSC_XCOORD, "d"},
697     {NSC_YCOORD, "d"},
698     {NSC_TIME, "d"},
699     {NSC_FLOAT, "g"},
700     {NSC_STRINGY,"c"},
701     {NSC_NOTYPE, NULL}
702 };
703
704 struct symbol missions[] = {
705     {MI_NONE, "none"},
706     {MI_INTERDICT, "interdiction"},
707     {MI_SUPPORT, "support"},
708     {MI_RESERVE, "reserve"},
709     {MI_ESCORT, "escort"},
710     {MI_AIR_DEFENSE, "air defense"},
711     {MI_DSUPPORT, "defensive support"},
712     {MI_OSUPPORT, "offensive support"},
713     {0, NULL}
714 };
715
716 struct symbol plane_flags[] = {
717     {PLN_LAUNCHED, "launched"},
718     {PLN_SYNCHRONOUS, "synchronous"},
719     {PLN_AIRBURST, "airbust"},
720     {0, NULL}
721 };
722
723 struct symbol retreat_flags[] = {
724     {RET_GROUP, "group"},
725     {RET_INJURED, "injured"},
726     {RET_TORPED, "torped"},
727     {RET_SONARED, "sonared"},
728     {RET_HELPLESS, "helpless"},
729     {RET_BOMBED, "bombed"},
730     {RET_DCHRGED, "depth-charged"},
731     {RET_BOARDED, "boarded"},
732     {0, NULL}
733 };
734
735 struct symbol nation_status[] = {
736     {STAT_UNUSED, "unused"},
737     {STAT_NEW,  "new"},
738     {STAT_VIS, "visitor"},
739     {STAT_SANCT, "sanctuary"},
740     {STAT_ACTIVE, "active"},
741     {STAT_GOD, "deity"},
742     {0, NULL}
743 };
744
745 struct symbol nation_flags[] = {
746     {NF_INFORM, "inform"},
747     {NF_FLASH, "flash"},
748     {NF_BEEP, "beep"},
749     {NF_COASTWATCH, "coastwatch"},
750     {NF_SONAR, "sonar"},
751     {NF_TECHLISTS, "techlists"},
752     {NF_SACKED, "sacked"},
753     {0, NULL}
754 };
755
756 struct symbol nation_relations[] = {
757     {AT_WAR, "at-war"},
758     {SITZKRIEG, "sitzkrieg"},
759     {MOBILIZATION, "mobilization"},
760     {HOSTILE, "hostile"},
761     {NEUTRAL, "neutral"},
762     {FRIENDLY, "friendly"},
763     {ALLIED, "allied"},
764     {0, NULL}
765 };
766
767 struct symbol level[] = {
768     {-1, "none"},
769     {NAT_TLEV, "technology"},
770     {NAT_RLEV, "research"},
771     {NAT_ELEV, "education"},
772     {NAT_HLEV, "happiness"},
773     {0, NULL}
774 };
775
776 struct symbol agreement_statuses[] = {
777     {AGREE_FREE, "free"},
778     {AGREE_PROPOSED, "proposed"},
779     {AGREE_SIGNED, "signed"},
780     {0, NULL}
781 };
782
783 struct symbol plague_stages[] = {
784     {PLG_HEALTHY, "healthy"},
785     {PLG_DYING, "dying"},
786     {PLG_INFECT, "infect"},
787     {PLG_INCUBATE, "incubate"},
788     {PLG_EXPOSED, "exposed"},
789     {0, NULL}
790 };
791
792 struct symbol packing[] = {
793     {IPKG, "inefficient"},
794     {NPKG, "normal"},
795     {WPKG, "warehouse"},
796     {UPKG, "urban"},
797     {BPKG, "bank"},
798     {0, NULL}
799 };
800
801 struct symbol resources[] = {
802     /* names should match resource selector names in sect_ca[] */
803     {0, "none"},
804     {offsetof(struct sctstr, sct_min), "min"},
805     {offsetof(struct sctstr, sct_gmin), "gold"},
806     {offsetof(struct sctstr, sct_fertil), "fert"},
807     {offsetof(struct sctstr, sct_oil), "ocontent"},
808     {offsetof(struct sctstr, sct_uran), "uran"},
809     {0, NULL}
810 };
811
812 struct symbol sector_navigation[] = {
813     {NAV_NONE, "land"},
814     {NAVOK, "sea"},
815     {NAV_02, "harbor"},
816     {NAV_CANAL, "canal"},
817     {NAV_60, "bridge"},
818     {0, NULL}
819 };