#include "nsc.h"
#include "product.h"
-#define fldoff(str, fld) offsetof(struct str, fld)
+/* Ugly hack to improve legibility by avoid long lines */
+#define fldoff(fld) offsetof(CURSTR, fld)
+#define empobjoff(fld) offsetof(struct empobj, fld)
-#define NSC_IELT(name, pfx, sfx, base, itype) \
-{NSC_SHORT, 0, 0, ((base) + (itype)*sizeof(unsigned short)), \
-sizeof(sfx) == 1 ? name : pfx sfx, EF_BAD}
+#define NSC_IELT(name, pfx, sfx, base, itype) \
+ {sizeof(sfx) == 1 ? name : pfx sfx, \
+ ((base) + (itype)*sizeof(unsigned short)), \
+ NSC_SHORT, 0, EF_BAD, 0}
#define NSC_IVEC(base, sfx) \
NSC_IELT("civil", "c", sfx, base, I_CIVIL), \
NSC_IELT("rad", "r", sfx, base, I_RAD)
struct castr ichr_ca[] = {
- {NSC_SITYPE(i_type), 0, 0, offsetof(struct ichrstr, i_uid), "uid",
- EF_ITEM},
- {NSC_STRING, 0, 0, offsetof(struct ichrstr, i_name), "name", EF_BAD},
- {NSC_STRINGY, NSC_CONST, 1, offsetof(struct ichrstr, i_mnem), "mnem",
- EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct ichrstr, i_value), "value", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct ichrstr, i_sell), "sell", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct ichrstr, i_lbs), "lbs", EF_BAD},
- {NSC_INT, 0, NUMPKG, offsetof(struct ichrstr, i_pkg), "pkg", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct ichrstr, i_melt_denom), "melt_denom",
- EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+#define CURSTR struct ichrstr
+ {"uid", fldoff(i_uid), NSC_SITYPE(i_type), 0, EF_ITEM, 0},
+ {"name", fldoff(i_name), NSC_STRING, 0, EF_BAD, 0},
+ {"mnem", fldoff(i_mnem), NSC_STRINGY, 1, EF_BAD, NSC_CONST},
+ {"value", fldoff(i_value), NSC_INT, 0, EF_BAD, 0},
+ {"sell", fldoff(i_sell), NSC_INT, 0, EF_BAD, 0},
+ {"lbs", fldoff(i_lbs), NSC_INT, 0, EF_BAD, 0},
+ {"pkg", fldoff(i_pkg), NSC_INT, NUMPKG, EF_BAD, 0},
+ {"melt_denom", fldoff(i_melt_denom), NSC_INT, 0, EF_BAD, 0},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr pchr_ca[] = {
- {NSC_INT, 0, 0, offsetof(struct pchrstr, p_uid), "uid", EF_PRODUCT},
- {NSC_STRING, 0, 0, offsetof(struct pchrstr, p_name), "name", EF_BAD},
- {NSC_STRING, NSC_CONST, 0, offsetof(struct pchrstr, p_sname), "sname",
- EF_BAD},
- {NSC_SITYPE(i_type), 0, MAXPRCON, offsetof(struct pchrstr, p_ctype),
- "ctype", EF_ITEM},
- {NSC_USHORT, 0, MAXPRCON, offsetof(struct pchrstr, p_camt), "camt",
- EF_BAD},
- {NSC_SITYPE(i_type), 0, 0, offsetof(struct pchrstr, p_type), "type",
- EF_ITEM},
- {NSC_INT, 0, 0, offsetof(struct pchrstr, p_level), "level", EF_LEVEL},
- {NSC_INT, 0, 0, offsetof(struct pchrstr, p_cost), "cost", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nrndx), "nrndx", EF_RESOURCES},
- {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nrdep), "nrdep", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nlndx), "nlndx", EF_LEVEL},
- {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nlmin), "nlmin", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nllag), "nllag", EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+#define CURSTR struct pchrstr
+ {"uid", fldoff(p_uid), NSC_INT, 0, EF_PRODUCT, 0},
+ {"name", fldoff(p_name), NSC_STRING, 0, EF_BAD, 0},
+ {"sname", fldoff(p_sname), NSC_STRING, 0, EF_BAD, NSC_CONST},
+ {"ctype", fldoff(p_ctype), NSC_SITYPE(i_type), MAXPRCON, EF_ITEM, 0},
+ {"camt", fldoff(p_camt), NSC_USHORT, MAXPRCON, EF_BAD, 0},
+ {"type", fldoff(p_type), NSC_SITYPE(i_type), 0, EF_ITEM, 0},
+ {"level", fldoff(p_level), NSC_INT, 0, EF_LEVEL, 0},
+ {"cost", fldoff(p_cost), NSC_INT, 0, EF_BAD, 0},
+ {"nrndx", fldoff(p_nrndx), NSC_INT, 0, EF_RESOURCES, 0},
+ {"nrdep", fldoff(p_nrdep), NSC_INT, 0, EF_BAD, 0},
+ {"nlndx", fldoff(p_nlndx), NSC_INT, 0, EF_LEVEL, 0},
+ {"nlmin", fldoff(p_nlmin), NSC_INT, 0, EF_BAD, 0},
+ {"nllag", fldoff(p_nllag), NSC_INT, 0, EF_BAD, 0},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr sect_ca[] = {
+#define CURSTR struct sctstr
/* uid needs to be NSC_DEITY because it discloses true origin */
- {NSC_SHORT, NSC_DEITY | NSC_EXTRA, 0, fldoff(sctstr, sct_uid), "uid",
- EF_SECTOR},
- {NSC_NATID, 0, 0, fldoff(sctstr, sct_own), "owner", EF_NATION},
- {NSC_XCOORD, NSC_CONST, 0, fldoff(sctstr, sct_x), "xloc", EF_BAD},
- {NSC_YCOORD, NSC_CONST, 0, fldoff(sctstr, sct_y), "yloc", EF_BAD},
- {NSC_CHAR, 0, 0, fldoff(sctstr, sct_type), "des", EF_SECTOR_CHR},
- {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_effic), "effic", EF_BAD},
- {NSC_SHORT, 0, 0, fldoff(sctstr, sct_mobil), "mobil", EF_BAD},
- {NSC_UCHAR, NSC_DEITY, 0, fldoff(sctstr, sct_loyal), "loyal", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr), "terr", EF_BAD},
- {NSC_UCHAR, NSC_EXTRA, 0, fldoff(sctstr, sct_terr), "terr0", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr1), "terr1", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr2), "terr2", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr3), "terr3", EF_BAD},
- {NSC_UCHAR, NSC_DEITY, 0, fldoff(sctstr, sct_dterr), "dterr", EF_BAD},
- {NSC_XCOORD, 0, 0, fldoff(sctstr, sct_dist_x), "xdist", EF_BAD},
- {NSC_YCOORD, 0, 0, fldoff(sctstr, sct_dist_y), "ydist", EF_BAD},
- {NSC_SHORT, 0, 0, fldoff(sctstr, sct_avail), "avail", EF_BAD},
- {NSC_SHORT, NSC_DEITY, 0, fldoff(sctstr, sct_elev), "elev", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_work), "work", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_coastal), "coastal", EF_BAD},
- {NSC_CHAR, 0, 0, fldoff(sctstr, sct_newtype), "newdes", EF_SECTOR_CHR},
- {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_min), "min", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_gmin), "gold", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_fertil), "fert", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_oil), "ocontent", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_uran), "uran", EF_BAD},
- {NSC_NATID, 0, 0, fldoff(sctstr, sct_oldown), "oldown", EF_NATION},
- {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_off), "off", EF_BAD},
- NSC_IVEC(fldoff(sctstr, sct_item), ""),
- NSC_IVEC(fldoff(sctstr, sct_dist), "_dist"),
- NSC_IVEC(fldoff(sctstr, sct_del), "_del"),
+ {"uid", fldoff(sct_uid), NSC_SHORT, 0, EF_SECTOR, NSC_DEITY | NSC_EXTRA},
+ {"owner", fldoff(sct_own), NSC_NATID, 0, EF_NATION, 0},
+ {"xloc", fldoff(sct_x), NSC_XCOORD, 0, EF_BAD, NSC_CONST},
+ {"yloc", fldoff(sct_y), NSC_YCOORD, 0, EF_BAD, NSC_CONST},
+ {"des", fldoff(sct_type), NSC_CHAR, 0, EF_SECTOR_CHR, 0},
+ {"effic", fldoff(sct_effic), NSC_UCHAR, 0, EF_BAD, 0},
+ {"mobil", fldoff(sct_mobil), NSC_SHORT, 0, EF_BAD, 0},
+ {"loyal", fldoff(sct_loyal), NSC_UCHAR, 0, EF_BAD, NSC_DEITY},
+ {"terr", fldoff(sct_terr), NSC_UCHAR, 0, EF_BAD, 0},
+ {"terr0", fldoff(sct_terr), NSC_UCHAR, 0, EF_BAD, NSC_EXTRA},
+ {"terr1", fldoff(sct_terr1), NSC_UCHAR, 0, EF_BAD, 0},
+ {"terr2", fldoff(sct_terr2), NSC_UCHAR, 0, EF_BAD, 0},
+ {"terr3", fldoff(sct_terr3), NSC_UCHAR, 0, EF_BAD, 0},
+ {"dterr", fldoff(sct_dterr), NSC_UCHAR, 0, EF_BAD, NSC_DEITY},
+ {"xdist", fldoff(sct_dist_x), NSC_XCOORD, 0, EF_BAD, 0},
+ {"ydist", fldoff(sct_dist_y), NSC_YCOORD, 0, EF_BAD, 0},
+ {"avail", fldoff(sct_avail), NSC_SHORT, 0, EF_BAD, 0},
+ {"elev", fldoff(sct_elev), NSC_SHORT, 0, EF_BAD, NSC_DEITY},
+ {"work", fldoff(sct_work), NSC_UCHAR, 0, EF_BAD, 0},
+ {"coastal", fldoff(sct_coastal), NSC_UCHAR, 0, EF_BAD, 0},
+ {"newdes", fldoff(sct_newtype), NSC_CHAR, 0, EF_SECTOR_CHR, 0},
+ {"min", fldoff(sct_min), NSC_UCHAR, 0, EF_BAD, 0},
+ {"gold", fldoff(sct_gmin), NSC_UCHAR, 0, EF_BAD, 0},
+ {"fert", fldoff(sct_fertil), NSC_UCHAR, 0, EF_BAD, 0},
+ {"ocontent", fldoff(sct_oil), NSC_UCHAR, 0, EF_BAD, 0},
+ {"uran", fldoff(sct_uran), NSC_UCHAR, 0, EF_BAD, 0},
+ {"oldown", fldoff(sct_oldown), NSC_NATID, 0, EF_NATION, 0},
+ {"off", fldoff(sct_off), NSC_UCHAR, 0, EF_BAD, 0},
+ NSC_IVEC(fldoff(sct_item), ""),
+ NSC_IVEC(fldoff(sct_dist), "_dist"),
+ NSC_IVEC(fldoff(sct_del), "_del"),
/* should let old owner access mines, but can't express that: */
- {NSC_SHORT, NSC_DEITY, 0, fldoff(sctstr, sct_mines), "mines", EF_BAD},
- {NSC_SHORT, NSC_DEITY, 0, fldoff(sctstr, sct_pstage), "pstage",
- EF_PLAGUE_STAGES},
- {NSC_SHORT, NSC_DEITY, 0, fldoff(sctstr, sct_ptime), "ptime", EF_BAD},
- {NSC_UCHAR, NSC_DEITY, 0, fldoff(sctstr, sct_che), "che", EF_BAD},
- {NSC_NATID, NSC_DEITY, 0, fldoff(sctstr, sct_che_target), "che_target",
- EF_NATION},
- {NSC_USHORT, 0, 0, fldoff(sctstr, sct_fallout), "fallout", EF_BAD},
- {NSC_SHORT, 0, 0, fldoff(sctstr, sct_access), "access", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_road), "road", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_rail), "rail", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_defense), "dfense", EF_BAD},
- {NSC_TIME, NSC_EXTRA, 0, fldoff(sctstr, sct_timestamp), "timestamp",
- EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+ {"mines", fldoff(sct_mines), NSC_SHORT, 0, EF_BAD, NSC_DEITY},
+ {"pstage", fldoff(sct_pstage), NSC_SHORT, 0, EF_PLAGUE_STAGES, NSC_DEITY},
+ {"ptime", fldoff(sct_ptime), NSC_SHORT, 0, EF_BAD, NSC_DEITY},
+ {"che", fldoff(sct_che), NSC_UCHAR, 0, EF_BAD, NSC_DEITY},
+ {"che_target", fldoff(sct_che_target), NSC_NATID, 0, EF_NATION, NSC_DEITY},
+ {"fallout", fldoff(sct_fallout), NSC_USHORT, 0, EF_BAD, 0},
+ {"access", fldoff(sct_access), NSC_SHORT, 0, EF_BAD, 0},
+ {"road", fldoff(sct_road), NSC_UCHAR, 0, EF_BAD, 0},
+ {"rail", fldoff(sct_rail), NSC_UCHAR, 0, EF_BAD, 0},
+ {"dfense", fldoff(sct_defense), NSC_UCHAR, 0, EF_BAD, 0},
+ {"timestamp", fldoff(sct_timestamp), NSC_TIME, 0, EF_BAD, NSC_EXTRA},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr dchr_ca[] = {
- {NSC_UCHAR, 0, 0, offsetof(struct dchrstr, d_uid), "uid", EF_SECTOR_CHR},
- {NSC_STRING, 0, 0, offsetof(struct dchrstr, d_name), "name", EF_BAD},
- {NSC_STRINGY, NSC_CONST, 1, offsetof(struct dchrstr, d_mnem), "mnem",
- EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct dchrstr, d_prd), "prd", EF_PRODUCT},
- {NSC_INT, 0, 0, offsetof(struct dchrstr, d_peffic), "peffic", EF_BAD},
- {NSC_FLOAT, 0, 0, offsetof(struct dchrstr, d_mob0), "mob0", EF_BAD},
- {NSC_FLOAT, 0, 0, offsetof(struct dchrstr, d_mob1), "mob1", EF_BAD},
- {NSC_SITYPE(d_navigation), 0, 0, offsetof(struct dchrstr, d_nav), "nav",
- EF_SECTOR_NAVIGATION},
- {NSC_SITYPE(i_packing), 0, 0, offsetof(struct dchrstr, d_pkg), "pkg",
- EF_PACKING},
- {NSC_FLOAT, 0, 0, offsetof(struct dchrstr, d_ostr), "ostr", EF_BAD},
- {NSC_FLOAT, 0, 0, offsetof(struct dchrstr, d_dstr), "dstr", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct dchrstr, d_value), "value", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct dchrstr, d_cost), "cost", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct dchrstr, d_build), "build", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct dchrstr, d_lcms), "lcms", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct dchrstr, d_hcms), "hcms", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct dchrstr, d_maxpop), "maxpop", EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+#define CURSTR struct dchrstr
+ {"uid", fldoff(d_uid), NSC_UCHAR, 0, EF_SECTOR_CHR, 0},
+ {"name", fldoff(d_name), NSC_STRING, 0, EF_BAD, 0},
+ {"mnem", fldoff(d_mnem), NSC_STRINGY, 1, EF_BAD, NSC_CONST},
+ {"prd", fldoff(d_prd), NSC_INT, 0, EF_PRODUCT, 0},
+ {"peffic", fldoff(d_peffic), NSC_INT, 0, EF_BAD, 0},
+ {"mob0", fldoff(d_mob0), NSC_FLOAT, 0, EF_BAD, 0},
+ {"mob1", fldoff(d_mob1), NSC_FLOAT, 0, EF_BAD, 0},
+ {"nav", fldoff(d_nav), NSC_SITYPE(d_navigation), 0, EF_SECTOR_NAVIGATION, 0},
+ {"pkg", fldoff(d_pkg), NSC_SITYPE(i_packing), 0, EF_PACKING, 0},
+ {"ostr", fldoff(d_ostr), NSC_FLOAT, 0, EF_BAD, 0},
+ {"dstr", fldoff(d_dstr), NSC_FLOAT, 0, EF_BAD, 0},
+ {"value", fldoff(d_value), NSC_INT, 0, EF_BAD, 0},
+ {"cost", fldoff(d_cost), NSC_INT, 0, EF_BAD, 0},
+ {"build", fldoff(d_build), NSC_INT, 0, EF_BAD, 0},
+ {"lcms", fldoff(d_lcms), NSC_INT, 0, EF_BAD, 0},
+ {"hcms", fldoff(d_hcms), NSC_INT, 0, EF_BAD, 0},
+ {"maxpop", fldoff(d_maxpop), NSC_INT, 0, EF_BAD, 0},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
#define NSC_GENITEM(ef_type, ef_chr) \
-{ NSC_SHORT, 0, 0, fldoff(empobj, uid), "uid", ef_type}, \
-{ NSC_NATID, 0, 0, fldoff(empobj, own), "owner", EF_NATION}, \
-{ NSC_XCOORD, 0, 0, fldoff(empobj, x), "xloc", EF_BAD}, \
-{ NSC_YCOORD, 0, 0, fldoff(empobj, y), "yloc", EF_BAD}, \
-{ NSC_CHAR, 0, 0, fldoff(empobj, type), "type", ef_chr}, \
-{ NSC_CHAR, 0, 0, fldoff(empobj, effic), "effic", EF_BAD}, \
-{ NSC_CHAR , 0, 0, fldoff(empobj, mobil), "mobil", EF_BAD}, \
-{ NSC_UCHAR , 0, 0, fldoff(empobj, off), "off", EF_BAD}, \
-{ NSC_SHORT, 0, 0, fldoff(empobj, tech), "tech", EF_BAD}, \
-{ NSC_STRINGY, NSC_EXTRA, 1, fldoff(empobj, group), "group", EF_BAD}, \
-{ NSC_XCOORD, 0, 0, fldoff(empobj, opx), "opx", EF_BAD}, \
-{ NSC_YCOORD, 0, 0, fldoff(empobj, opy), "opy", EF_BAD}, \
-{ NSC_SHORT, 0, 0, fldoff(empobj, mission), "mission", EF_MISSIONS}, \
-{ NSC_SHORT, 0, 0, fldoff(empobj, radius), "radius", EF_BAD}
+ {"uid", empobjoff(uid), NSC_SHORT, 0, ef_type, 0}, \
+ {"owner", empobjoff(own), NSC_NATID, 0, EF_NATION, 0}, \
+ {"xloc", empobjoff(x), NSC_XCOORD, 0, EF_BAD, 0}, \
+ {"yloc", empobjoff(y), NSC_YCOORD, 0, EF_BAD, 0}, \
+ {"type", empobjoff(type), NSC_CHAR, 0, ef_chr, 0}, \
+ {"effic", empobjoff(effic), NSC_CHAR, 0, EF_BAD, 0}, \
+ {"mobil", empobjoff(mobil), NSC_CHAR , 0, EF_BAD, 0}, \
+ {"off", empobjoff(off), NSC_UCHAR , 0, EF_BAD, 0}, \
+ {"tech", empobjoff(tech), NSC_SHORT, 0, EF_BAD, 0}, \
+ {"group", empobjoff(group), NSC_STRINGY, 1, EF_BAD, NSC_EXTRA}, \
+ {"opx", empobjoff(opx), NSC_XCOORD, 0, EF_BAD, 0}, \
+ {"opy", empobjoff(opy), NSC_YCOORD, 0, EF_BAD, 0}, \
+ {"mission", empobjoff(mission), NSC_SHORT, 0, EF_MISSIONS, 0}, \
+ {"radius", empobjoff(radius), NSC_SHORT, 0, EF_BAD, 0}
struct castr ship_ca[] = {
+#define CURSTR struct shpstr
NSC_GENITEM(EF_SHIP, EF_SHIP_CHR),
- {NSC_STRINGY, 0, 1, fldoff(shpstr, shp_fleet), "fleet", EF_BAD},
- {NSC_UCHAR, NSC_EXTRA, 0, fldoff(shpstr, shp_nplane), "nplane", EF_BAD},
- {NSC_UCHAR, NSC_EXTRA, 0, fldoff(shpstr, shp_nland), "nland", EF_BAD},
- {NSC_XCOORD, 0, 0, fldoff(shpstr, shp_destx[0]), "xstart", EF_BAD},
- {NSC_XCOORD, 0, 0, fldoff(shpstr, shp_destx[1]), "xend", EF_BAD},
- {NSC_YCOORD, 0, 0, fldoff(shpstr, shp_desty[0]), "ystart", EF_BAD},
- {NSC_YCOORD, 0, 0, fldoff(shpstr, shp_desty[1]), "yend", EF_BAD},
- {NSC_SITYPE(i_type), 0, TMAX, fldoff(shpstr, shp_tstart), "cargostart",
- EF_ITEM},
- {NSC_SITYPE(i_type), 0, TMAX, fldoff(shpstr, shp_tend), "cargoend",
- EF_ITEM},
- {NSC_SHORT, 0, TMAX, fldoff(shpstr, shp_lstart), "amtstart", EF_BAD},
- {NSC_SHORT, 0, TMAX, fldoff(shpstr, shp_lend), "amtend", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(shpstr, shp_autonav), "autonav", EF_BAD},
- NSC_IVEC(fldoff(shpstr, shp_item), ""),
- {NSC_SHORT, NSC_DEITY, 0, fldoff(shpstr, shp_pstage), "pstage",
- EF_PLAGUE_STAGES},
- {NSC_SHORT, NSC_DEITY, 0, fldoff(shpstr, shp_ptime), "ptime", EF_BAD},
- {NSC_SHORT, 0, 0, fldoff(shpstr, shp_access), "access", EF_BAD},
- {NSC_TIME, NSC_EXTRA, 0, fldoff(shpstr, shp_timestamp), "timestamp",
- EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(shpstr, shp_mobquota), "mquota", EF_BAD},
- {NSC_STRINGY, 0, MAXSHPPATH, fldoff(shpstr, shp_path), "path", EF_BAD},
- {NSC_SHORT, 0, 0, fldoff(shpstr, shp_follow), "follow", EF_BAD},
- {NSC_STRINGY, 0, MAXSHPNAMLEN, fldoff(shpstr, shp_name), "name", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(shpstr, shp_fuel), "fuel", EF_BAD},
- {NSC_UCHAR, NSC_EXTRA, 0, fldoff(shpstr, shp_nchoppers), "nchoppers",
- EF_BAD},
- {NSC_UCHAR, NSC_EXTRA, 0, fldoff(shpstr, shp_nxlight), "nxlight", EF_BAD},
+ {"fleet", fldoff(shp_fleet), NSC_STRINGY, 1, EF_BAD, 0},
+ {"nplane", fldoff(shp_nplane), NSC_UCHAR, 0, EF_BAD, NSC_EXTRA},
+ {"nland", fldoff(shp_nland), NSC_UCHAR, 0, EF_BAD, NSC_EXTRA},
+ {"xstart", fldoff(shp_destx[0]), NSC_XCOORD, 0, EF_BAD, 0},
+ {"xend", fldoff(shp_destx[1]), NSC_XCOORD, 0, EF_BAD, 0},
+ {"ystart", fldoff(shp_desty[0]), NSC_YCOORD, 0, EF_BAD, 0},
+ {"yend", fldoff(shp_desty[1]), NSC_YCOORD, 0, EF_BAD, 0},
+ {"cargostart", fldoff(shp_tstart), NSC_SITYPE(i_type), TMAX, EF_ITEM, 0},
+ {"cargoend", fldoff(shp_tend), NSC_SITYPE(i_type), TMAX, EF_ITEM, 0},
+ {"amtstart", fldoff(shp_lstart), NSC_SHORT, TMAX, EF_BAD, 0},
+ {"amtend", fldoff(shp_lend), NSC_SHORT, TMAX, EF_BAD, 0},
+ {"autonav", fldoff(shp_autonav), NSC_UCHAR, 0, EF_BAD, 0},
+ NSC_IVEC(fldoff(shp_item), ""),
+ {"pstage", fldoff(shp_pstage), NSC_SHORT, 0, EF_PLAGUE_STAGES, NSC_DEITY},
+ {"ptime", fldoff(shp_ptime), NSC_SHORT, 0, EF_BAD, NSC_DEITY},
+ {"access", fldoff(shp_access), NSC_SHORT, 0, EF_BAD, 0},
+ {"timestamp", fldoff(shp_timestamp), NSC_TIME, 0, EF_BAD, NSC_EXTRA},
+ {"mquota", fldoff(shp_mobquota), NSC_UCHAR, 0, EF_BAD, 0},
+ {"path", fldoff(shp_path), NSC_STRINGY, MAXSHPPATH, EF_BAD, 0},
+ {"follow", fldoff(shp_follow), NSC_SHORT, 0, EF_BAD, 0},
+ {"name", fldoff(shp_name), NSC_STRINGY, MAXSHPNAMLEN, EF_BAD, 0},
+ {"fuel", fldoff(shp_fuel), NSC_UCHAR, 0, EF_BAD, 0},
+ {"nchoppers", fldoff(shp_nchoppers), NSC_UCHAR, 0, EF_BAD, NSC_EXTRA},
+ {"nxlight", fldoff(shp_nxlight), NSC_UCHAR, 0, EF_BAD, NSC_EXTRA},
/* should let builder access xbuilt, ybuilt, but can't express that: */
- {NSC_XCOORD, NSC_DEITY, 0, fldoff(shpstr, shp_orig_x), "xbuilt", EF_BAD},
- {NSC_YCOORD, NSC_DEITY, 0, fldoff(shpstr, shp_orig_y), "ybuilt", EF_BAD},
- {NSC_NATID, NSC_DEITY, 0, fldoff(shpstr, shp_orig_own), "builder",
- EF_NATION},
- {NSC_INT, NSC_BITS, 0, fldoff(shpstr, shp_rflags), "rflags",
- EF_RETREAT_FLAGS},
- {NSC_STRINGY, 0, RET_LEN, fldoff(shpstr, shp_rpath), "rpath", EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+ {"xbuilt", fldoff(shp_orig_x), NSC_XCOORD, 0, EF_BAD, NSC_DEITY},
+ {"ybuilt", fldoff(shp_orig_y), NSC_YCOORD, 0, EF_BAD, NSC_DEITY},
+ {"builder", fldoff(shp_orig_own), NSC_NATID, 0, EF_NATION, NSC_DEITY},
+ {"rflags", fldoff(shp_rflags), NSC_INT, 0, EF_RETREAT_FLAGS, NSC_BITS},
+ {"rpath", fldoff(shp_rpath), NSC_STRINGY, RET_LEN, EF_BAD, 0},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr mchr_ca[] = {
- {NSC_CHAR, 0, 0, offsetof(struct mchrstr, m_type), "type", EF_SHIP_CHR},
- {NSC_STRING, 0, 0, offsetof(struct mchrstr, m_name), "name", EF_BAD},
- NSC_IVEC(offsetof(struct mchrstr, m_item), ""),
- {NSC_INT, 0, 0, offsetof(struct mchrstr, m_lcm), "l_build", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct mchrstr, m_hcm), "h_build", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct mchrstr, m_armor), "armor", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct mchrstr, m_speed), "speed", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct mchrstr, m_visib), "visib", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct mchrstr, m_vrnge), "vrnge", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct mchrstr, m_frnge), "frnge", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct mchrstr, m_glim), "glim", EF_BAD},
- {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_nxlight), "nxlight", EF_BAD},
- {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_nchoppers), "nchoppers",
- EF_BAD},
- {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_fuelc), "fuelc", EF_BAD},
- {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_fuelu), "fuelu", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct mchrstr, m_tech), "tech", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct mchrstr, m_cost), "cost", EF_BAD},
- {NSC_LONG, NSC_BITS, 0, offsetof(struct mchrstr, m_flags), "flags",
- EF_SHIP_CHR_FLAGS},
- {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_nplanes), "nplanes", EF_BAD},
- {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_nland), "nland", EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+#define CURSTR struct mchrstr
+ {"type", fldoff(m_type), NSC_CHAR, 0, EF_SHIP_CHR, 0},
+ {"name", fldoff(m_name), NSC_STRING, 0, EF_BAD, 0},
+ NSC_IVEC(fldoff(m_item), ""),
+ {"l_build", fldoff(m_lcm), NSC_INT, 0, EF_BAD, 0},
+ {"h_build", fldoff(m_hcm), NSC_INT, 0, EF_BAD, 0},
+ {"armor", fldoff(m_armor), NSC_INT, 0, EF_BAD, 0},
+ {"speed", fldoff(m_speed), NSC_INT, 0, EF_BAD, 0},
+ {"visib", fldoff(m_visib), NSC_INT, 0, EF_BAD, 0},
+ {"vrnge", fldoff(m_vrnge), NSC_INT, 0, EF_BAD, 0},
+ {"frnge", fldoff(m_frnge), NSC_INT, 0, EF_BAD, 0},
+ {"glim", fldoff(m_glim), NSC_INT, 0, EF_BAD, 0},
+ {"nxlight", fldoff(m_nxlight), NSC_UCHAR, 0, EF_BAD, 0},
+ {"nchoppers", fldoff(m_nchoppers), NSC_UCHAR, 0, EF_BAD, 0},
+ {"fuelc", fldoff(m_fuelc), NSC_UCHAR, 0, EF_BAD, 0},
+ {"fuelu", fldoff(m_fuelu), NSC_UCHAR, 0, EF_BAD, 0},
+ {"tech", fldoff(m_tech), NSC_INT, 0, EF_BAD, 0},
+ {"cost", fldoff(m_cost), NSC_INT, 0, EF_BAD, 0},
+ {"flags", fldoff(m_flags), NSC_LONG, 0, EF_SHIP_CHR_FLAGS, NSC_BITS},
+ {"nplanes", fldoff(m_nplanes), NSC_UCHAR, 0, EF_BAD, 0},
+ {"nland", fldoff(m_nland), NSC_UCHAR, 0, EF_BAD, 0},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr plane_ca[] = {
+#define CURSTR struct plnstr
NSC_GENITEM(EF_PLANE, EF_PLANE_CHR),
- {NSC_STRINGY, 0, 1, fldoff(plnstr, pln_wing), "wing", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(plnstr, pln_range), "range", EF_BAD},
- {NSC_SHORT, 0, 0, fldoff(plnstr, pln_ship), "ship", EF_BAD},
- {NSC_SHORT, 0, 0, fldoff(plnstr, pln_land), "land", EF_BAD},
- {NSC_INT, NSC_EXTRA, 0, fldoff(plnstr, pln_att), "att", EF_BAD},
- {NSC_INT, NSC_EXTRA, 0, fldoff(plnstr, pln_def), "def", EF_BAD},
- {NSC_CHAR, 0, 0, fldoff(plnstr, pln_harden), "harden", EF_BAD},
- {NSC_CHAR, 0, 0, fldoff(plnstr, pln_nuketype), "nuketype", EF_BAD},
- {NSC_CHAR, NSC_BITS, 0, fldoff(plnstr, pln_flags), "flags",
- EF_PLANE_FLAGS},
- {NSC_SHORT, 0, 0, fldoff(plnstr, pln_access), "access", EF_BAD},
- {NSC_TIME, NSC_EXTRA, 0, fldoff(plnstr, pln_timestamp), "timestamp",
- EF_BAD},
- {NSC_FLOAT, 0, 0, fldoff(plnstr, pln_theta), "theta", EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+ {"wing", fldoff(pln_wing), NSC_STRINGY, 1, EF_BAD, 0},
+ {"range", fldoff(pln_range), NSC_UCHAR, 0, EF_BAD, 0},
+ {"ship", fldoff(pln_ship), NSC_SHORT, 0, EF_BAD, 0},
+ {"land", fldoff(pln_land), NSC_SHORT, 0, EF_BAD, 0},
+ {"att", fldoff(pln_att), NSC_INT, 0, EF_BAD, NSC_EXTRA},
+ {"def", fldoff(pln_def), NSC_INT, 0, EF_BAD, NSC_EXTRA},
+ {"harden", fldoff(pln_harden), NSC_CHAR, 0, EF_BAD, 0},
+ {"nuketype", fldoff(pln_nuketype), NSC_CHAR, 0, EF_BAD, 0},
+ {"flags", fldoff(pln_flags), NSC_CHAR, 0, EF_PLANE_FLAGS, NSC_BITS},
+ {"access", fldoff(pln_access), NSC_SHORT, 0, EF_BAD, 0},
+ {"timestamp", fldoff(pln_timestamp), NSC_TIME, 0, EF_BAD, NSC_EXTRA},
+ {"theta", fldoff(pln_theta), NSC_FLOAT, 0, EF_BAD, 0},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr plchr_ca[] = {
- {NSC_CHAR, 0, 0, offsetof(struct plchrstr, pl_type), "type", EF_PLANE_CHR},
- {NSC_STRING, 0, 0, offsetof(struct plchrstr, pl_name), "name", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_lcm), "l_build", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_hcm), "h_build", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_cost), "cost", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_tech), "tech", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_acc), "acc", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_load), "load", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_att), "att", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_def), "def", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_range), "range", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_crew), "crew", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_fuel), "fuel", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_stealth), "stealth", EF_BAD},
- {NSC_INT, NSC_BITS, 0, offsetof(struct plchrstr, pl_flags), "flags",
- EF_PLANE_CHR_FLAGS},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+#define CURSTR struct plchrstr
+ {"type", fldoff(pl_type), NSC_CHAR, 0, EF_PLANE_CHR, 0},
+ {"name", fldoff(pl_name), NSC_STRING, 0, EF_BAD, 0},
+ {"l_build", fldoff(pl_lcm), NSC_INT, 0, EF_BAD, 0},
+ {"h_build", fldoff(pl_hcm), NSC_INT, 0, EF_BAD, 0},
+ {"cost", fldoff(pl_cost), NSC_INT, 0, EF_BAD, 0},
+ {"tech", fldoff(pl_tech), NSC_INT, 0, EF_BAD, 0},
+ {"acc", fldoff(pl_acc), NSC_INT, 0, EF_BAD, 0},
+ {"load", fldoff(pl_load), NSC_INT, 0, EF_BAD, 0},
+ {"att", fldoff(pl_att), NSC_INT, 0, EF_BAD, 0},
+ {"def", fldoff(pl_def), NSC_INT, 0, EF_BAD, 0},
+ {"range", fldoff(pl_range), NSC_INT, 0, EF_BAD, 0},
+ {"crew", fldoff(pl_crew), NSC_INT, 0, EF_BAD, 0},
+ {"fuel", fldoff(pl_fuel), NSC_INT, 0, EF_BAD, 0},
+ {"stealth", fldoff(pl_stealth), NSC_INT, 0, EF_BAD, 0},
+ {"flags", fldoff(pl_flags), NSC_INT, 0, EF_PLANE_CHR_FLAGS, NSC_BITS},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr land_ca[] = {
+#define CURSTR struct lndstr
NSC_GENITEM(EF_LAND, EF_LAND_CHR),
- {NSC_STRINGY, 0, 1, fldoff(lndstr, lnd_army), "army", EF_BAD},
- {NSC_SHORT, 0, 0, fldoff(lndstr, lnd_ship), "ship", EF_BAD},
- {NSC_CHAR, 0, 0, fldoff(lndstr, lnd_harden), "harden", EF_BAD},
- {NSC_SHORT, 0, 0, fldoff(lndstr, lnd_retreat), "retreat", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(lndstr, lnd_fuel), "fuel", EF_BAD},
- {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_nxlight), "nxlight", EF_BAD},
- {NSC_INT, NSC_BITS, 0, fldoff(lndstr, lnd_rflags), "rflags",
- EF_RETREAT_FLAGS},
- {NSC_STRINGY, 0, RET_LEN, fldoff(lndstr, lnd_rpath), "rpath", EF_BAD},
- {NSC_UCHAR, 0, 0, fldoff(lndstr, lnd_rad_max), "react", EF_BAD},
- NSC_IVEC(fldoff(lndstr, lnd_item), ""),
- {NSC_SHORT, NSC_DEITY, 0, fldoff(lndstr, lnd_pstage), "pstage",
- EF_PLAGUE_STAGES},
- {NSC_SHORT, NSC_DEITY, 0, fldoff(lndstr, lnd_ptime), "ptime", EF_BAD},
- {NSC_SHORT, 0, 0, fldoff(lndstr, lnd_land), "land", EF_BAD},
- {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_nland), "nland", EF_BAD},
- {NSC_SHORT, 0, 0, fldoff(lndstr, lnd_access), "access", EF_BAD},
- {NSC_FLOAT, NSC_EXTRA, 0, fldoff(lndstr, lnd_att), "att", EF_BAD},
- {NSC_FLOAT, NSC_EXTRA, 0, fldoff(lndstr, lnd_def), "def", EF_BAD},
- {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_vul), "vul", EF_BAD},
- {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_spd), "spd", EF_BAD},
- {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_vis), "vis", EF_BAD},
- {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_spy), "spy", EF_BAD},
- {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_rad), "rmax", EF_BAD},
- {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_frg), "frg", EF_BAD},
- {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_acc), "acc", EF_BAD},
- {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_dam), "dam", EF_BAD},
- {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_ammo), "ammo", EF_BAD},
- {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_aaf), "aaf", EF_BAD},
- {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_fuelc), "fuelc", EF_BAD},
- {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_fuelu), "fuelu", EF_BAD},
- {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_maxlight), "maxlight",
- EF_BAD},
- {NSC_TIME, NSC_EXTRA, 0, fldoff(lndstr, lnd_timestamp), "timestamp",
- EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+ {"army", fldoff(lnd_army), NSC_STRINGY, 1, EF_BAD, 0},
+ {"ship", fldoff(lnd_ship), NSC_SHORT, 0, EF_BAD, 0},
+ {"harden", fldoff(lnd_harden), NSC_CHAR, 0, EF_BAD, 0},
+ {"retreat", fldoff(lnd_retreat), NSC_SHORT, 0, EF_BAD, 0},
+ {"fuel", fldoff(lnd_fuel), NSC_UCHAR, 0, EF_BAD, 0},
+ {"nxlight", fldoff(lnd_nxlight), NSC_UCHAR, 0, EF_BAD, NSC_EXTRA},
+ {"rflags", fldoff(lnd_rflags), NSC_INT, 0, EF_RETREAT_FLAGS, NSC_BITS},
+ {"rpath", fldoff(lnd_rpath), NSC_STRINGY, RET_LEN, EF_BAD, 0},
+ {"react", fldoff(lnd_rad_max), NSC_UCHAR, 0, EF_BAD, 0},
+ NSC_IVEC(fldoff(lnd_item), ""),
+ {"pstage", fldoff(lnd_pstage), NSC_SHORT, 0, EF_PLAGUE_STAGES, NSC_DEITY},
+ {"ptime", fldoff(lnd_ptime), NSC_SHORT, 0, EF_BAD, NSC_DEITY},
+ {"land", fldoff(lnd_land), NSC_SHORT, 0, EF_BAD, 0},
+ {"nland", fldoff(lnd_nland), NSC_UCHAR, 0, EF_BAD, NSC_EXTRA},
+ {"access", fldoff(lnd_access), NSC_SHORT, 0, EF_BAD, 0},
+ {"att", fldoff(lnd_att), NSC_FLOAT, 0, EF_BAD, NSC_EXTRA},
+ {"def", fldoff(lnd_def), NSC_FLOAT, 0, EF_BAD, NSC_EXTRA},
+ {"vul", fldoff(lnd_vul), NSC_INT, 0, EF_BAD, NSC_EXTRA},
+ {"spd", fldoff(lnd_spd), NSC_INT, 0, EF_BAD, NSC_EXTRA},
+ {"vis", fldoff(lnd_vis), NSC_INT, 0, EF_BAD, NSC_EXTRA},
+ {"spy", fldoff(lnd_spy), NSC_INT, 0, EF_BAD, NSC_EXTRA},
+ {"rmax", fldoff(lnd_rad), NSC_INT, 0, EF_BAD, NSC_EXTRA},
+ {"frg", fldoff(lnd_frg), NSC_INT, 0, EF_BAD, NSC_EXTRA},
+ {"acc", fldoff(lnd_acc), NSC_INT, 0, EF_BAD, NSC_EXTRA},
+ {"dam", fldoff(lnd_dam), NSC_INT, 0, EF_BAD, NSC_EXTRA},
+ {"ammo", fldoff(lnd_ammo), NSC_INT, 0, EF_BAD, NSC_EXTRA},
+ {"aaf", fldoff(lnd_aaf), NSC_INT, 0, EF_BAD, NSC_EXTRA},
+ {"fuelc", fldoff(lnd_fuelc), NSC_UCHAR, 0, EF_BAD, NSC_EXTRA},
+ {"fuelu", fldoff(lnd_fuelu), NSC_UCHAR, 0, EF_BAD, NSC_EXTRA},
+ {"maxlight", fldoff(lnd_maxlight), NSC_UCHAR, 0, EF_BAD, NSC_EXTRA},
+ {"timestamp", fldoff(lnd_timestamp), NSC_TIME, 0, EF_BAD, NSC_EXTRA},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr lchr_ca[] = {
- {NSC_CHAR, 0, 0, offsetof(struct lchrstr, l_type), "type", EF_LAND_CHR},
- {NSC_STRING, 0, 0, offsetof(struct lchrstr, l_name), "name", EF_BAD},
- NSC_IVEC(offsetof(struct lchrstr, l_item), ""),
- {NSC_INT, 0, 0, offsetof(struct lchrstr, l_lcm), "l_build", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct lchrstr, l_hcm), "h_build", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct lchrstr, l_tech), "tech", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct lchrstr, l_cost), "cost", EF_BAD},
- {NSC_FLOAT, 0, 0, offsetof(struct lchrstr, l_att), "att", EF_BAD},
- {NSC_FLOAT, 0, 0, offsetof(struct lchrstr, l_def), "def", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct lchrstr, l_vul), "vul", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct lchrstr, l_spd), "spd", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct lchrstr, l_vis), "vis", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct lchrstr, l_spy), "spy", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct lchrstr, l_rad), "rmax", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct lchrstr, l_frg), "frg", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct lchrstr, l_acc), "acc", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct lchrstr, l_dam), "dam", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct lchrstr, l_ammo), "ammo", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct lchrstr, l_aaf), "aaf", EF_BAD},
- {NSC_UCHAR, 0, 0, offsetof(struct lchrstr, l_fuelc), "fuelc", EF_BAD},
- {NSC_UCHAR, 0, 0, offsetof(struct lchrstr, l_fuelu), "fuelu", EF_BAD},
- {NSC_UCHAR, 0, 0, offsetof(struct lchrstr, l_nxlight), "nxlight", EF_BAD},
- {NSC_UCHAR, 0, 0, offsetof(struct lchrstr, l_nland), "nland", EF_BAD},
- {NSC_LONG, NSC_BITS, 0, offsetof(struct lchrstr, l_flags), "flags",
- EF_LAND_CHR_FLAGS},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+#define CURSTR struct lchrstr
+ {"type", fldoff(l_type), NSC_CHAR, 0, EF_LAND_CHR, 0},
+ {"name", fldoff(l_name), NSC_STRING, 0, EF_BAD, 0},
+ NSC_IVEC(fldoff(l_item), ""),
+ {"l_build", fldoff(l_lcm), NSC_INT, 0, EF_BAD, 0},
+ {"h_build", fldoff(l_hcm), NSC_INT, 0, EF_BAD, 0},
+ {"tech", fldoff(l_tech), NSC_INT, 0, EF_BAD, 0},
+ {"cost", fldoff(l_cost), NSC_INT, 0, EF_BAD, 0},
+ {"att", fldoff(l_att), NSC_FLOAT, 0, EF_BAD, 0},
+ {"def", fldoff(l_def), NSC_FLOAT, 0, EF_BAD, 0},
+ {"vul", fldoff(l_vul), NSC_INT, 0, EF_BAD, 0},
+ {"spd", fldoff(l_spd), NSC_INT, 0, EF_BAD, 0},
+ {"vis", fldoff(l_vis), NSC_INT, 0, EF_BAD, 0},
+ {"spy", fldoff(l_spy), NSC_INT, 0, EF_BAD, 0},
+ {"rmax", fldoff(l_rad), NSC_INT, 0, EF_BAD, 0},
+ {"frg", fldoff(l_frg), NSC_INT, 0, EF_BAD, 0},
+ {"acc", fldoff(l_acc), NSC_INT, 0, EF_BAD, 0},
+ {"dam", fldoff(l_dam), NSC_INT, 0, EF_BAD, 0},
+ {"ammo", fldoff(l_ammo), NSC_INT, 0, EF_BAD, 0},
+ {"aaf", fldoff(l_aaf), NSC_INT, 0, EF_BAD, 0},
+ {"fuelc", fldoff(l_fuelc), NSC_UCHAR, 0, EF_BAD, 0},
+ {"fuelu", fldoff(l_fuelu), NSC_UCHAR, 0, EF_BAD, 0},
+ {"nxlight", fldoff(l_nxlight), NSC_UCHAR, 0, EF_BAD, 0},
+ {"nland", fldoff(l_nland), NSC_UCHAR, 0, EF_BAD, 0},
+ {"flags", fldoff(l_flags), NSC_LONG, 0, EF_LAND_CHR_FLAGS, NSC_BITS},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr nuke_ca[] = {
+#define CURSTR struct nukstr
NSC_GENITEM(EF_NUKE, EF_NUKE_CHR),
- {NSC_SHORT, 0, 0, fldoff(nukstr, nuk_plane), "plane", EF_BAD},
- {NSC_TIME, NSC_EXTRA, 0, fldoff(nukstr, nuk_timestamp), "timestamp",
- EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+ {"plane", fldoff(nuk_plane), NSC_SHORT, 0, EF_BAD, 0},
+ {"timestamp", fldoff(nuk_timestamp), NSC_TIME, 0, EF_BAD, NSC_EXTRA},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr nchr_ca[] = {
- {NSC_CHAR, 0, 0, offsetof(struct nchrstr, n_type), "type", EF_NUKE_CHR},
- {NSC_STRING, 0, 0, offsetof(struct nchrstr, n_name), "name", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct nchrstr, n_lcm), "l_build", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct nchrstr, n_hcm), "h_build", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct nchrstr, n_oil), "o_build", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct nchrstr, n_rad), "r_build", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct nchrstr, n_blast), "blast", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct nchrstr, n_dam), "dam", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct nchrstr, n_cost), "cost", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct nchrstr, n_tech), "tech", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct nchrstr, n_weight), "weight", EF_BAD},
- {NSC_INT, NSC_BITS, 0, offsetof(struct nchrstr, n_flags), "flags",
- EF_NUKE_CHR_FLAGS},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+#define CURSTR struct nchrstr
+ {"type", fldoff(n_type), NSC_CHAR, 0, EF_NUKE_CHR, 0},
+ {"name", fldoff(n_name), NSC_STRING, 0, EF_BAD, 0},
+ {"l_build", fldoff(n_lcm), NSC_INT, 0, EF_BAD, 0},
+ {"h_build", fldoff(n_hcm), NSC_INT, 0, EF_BAD, 0},
+ {"o_build", fldoff(n_oil), NSC_INT, 0, EF_BAD, 0},
+ {"r_build", fldoff(n_rad), NSC_INT, 0, EF_BAD, 0},
+ {"blast", fldoff(n_blast), NSC_INT, 0, EF_BAD, 0},
+ {"dam", fldoff(n_dam), NSC_INT, 0, EF_BAD, 0},
+ {"cost", fldoff(n_cost), NSC_INT, 0, EF_BAD, 0},
+ {"tech", fldoff(n_tech), NSC_INT, 0, EF_BAD, 0},
+ {"weight", fldoff(n_weight), NSC_INT, 0, EF_BAD, 0},
+ {"flags", fldoff(n_flags), NSC_INT, 0, EF_NUKE_CHR_FLAGS, NSC_BITS},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr treaty_ca[] = {
- {NSC_SHORT, 0, 0, fldoff(trtstr, trt_uid), "uid", EF_TREATY},
- {NSC_NATID, 0, 0, fldoff(trtstr, trt_cna), "cna", EF_NATION},
- {NSC_NATID, 0, 0, fldoff(trtstr, trt_cnb), "cnb", EF_NATION},
- {NSC_CHAR, 0, 0, fldoff(trtstr, trt_status), "status",
- EF_AGREEMENT_STATUS},
- {NSC_SHORT, NSC_BITS, 0, fldoff(trtstr, trt_acond), "acond",
- EF_TREATY_FLAGS},
- {NSC_SHORT, NSC_BITS, 0, fldoff(trtstr, trt_bcond), "bcond",
- EF_TREATY_FLAGS},
- {NSC_TIME, 0, 0, fldoff(trtstr, trt_exp), "exp", EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+#define CURSTR struct trtstr
+ {"uid", fldoff(trt_uid), NSC_SHORT, 0, EF_TREATY, 0},
+ {"cna", fldoff(trt_cna), NSC_NATID, 0, EF_NATION, 0},
+ {"cnb", fldoff(trt_cnb), NSC_NATID, 0, EF_NATION, 0},
+ {"status", fldoff(trt_status), NSC_CHAR, 0, EF_AGREEMENT_STATUS, 0},
+ {"acond", fldoff(trt_acond), NSC_SHORT, 0, EF_TREATY_FLAGS, NSC_BITS},
+ {"bcond", fldoff(trt_bcond), NSC_SHORT, 0, EF_TREATY_FLAGS, NSC_BITS},
+ {"exp", fldoff(trt_exp), NSC_TIME, 0, EF_BAD, 0},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr loan_ca[] = {
- {NSC_SHORT, 0, 0, fldoff(lonstr, l_uid), "uid", EF_LOAN},
- {NSC_NATID, 0, 0, fldoff(lonstr, l_loner), "loaner", EF_NATION},
- {NSC_NATID, 0, 0, fldoff(lonstr, l_lonee), "loanee", EF_NATION},
- {NSC_CHAR, 0, 0, fldoff(lonstr, l_status), "status",
- EF_AGREEMENT_STATUS},
- {NSC_INT, 0, 0, fldoff(lonstr, l_irate), "irate", EF_BAD},
- {NSC_INT, 0, 0, fldoff(lonstr, l_ldur), "ldur", EF_BAD},
- {NSC_LONG, 0, 0, fldoff(lonstr, l_amtpaid), "amtpaid", EF_BAD},
- {NSC_LONG, 0, 0, fldoff(lonstr, l_amtdue), "amtdue", EF_BAD},
- {NSC_TIME, 0, 0, fldoff(lonstr, l_lastpay), "lastpay", EF_BAD},
- {NSC_TIME, 0, 0, fldoff(lonstr, l_duedate), "duedate", EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+#define CURSTR struct lonstr
+ {"uid", fldoff(l_uid), NSC_SHORT, 0, EF_LOAN, 0},
+ {"loaner", fldoff(l_loner), NSC_NATID, 0, EF_NATION, 0},
+ {"loanee", fldoff(l_lonee), NSC_NATID, 0, EF_NATION, 0},
+ {"status", fldoff(l_status), NSC_CHAR, 0, EF_AGREEMENT_STATUS, 0},
+ {"irate", fldoff(l_irate), NSC_INT, 0, EF_BAD, 0},
+ {"ldur", fldoff(l_ldur), NSC_INT, 0, EF_BAD, 0},
+ {"amtpaid", fldoff(l_amtpaid), NSC_LONG, 0, EF_BAD, 0},
+ {"amtdue", fldoff(l_amtdue), NSC_LONG, 0, EF_BAD, 0},
+ {"lastpay", fldoff(l_lastpay), NSC_TIME, 0, EF_BAD, 0},
+ {"duedate", fldoff(l_duedate), NSC_TIME, 0, EF_BAD, 0},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr news_ca[] = {
+#define CURSTR struct nwsstr
/* no need for uid as long as it's not referenced from other tables */
- {NSC_NATID, 0, 0, fldoff(nwsstr, nws_ano), "actor", EF_NATION},
- {NSC_UCHAR, 0, 0, fldoff(nwsstr, nws_vrb), "action", EF_NEWS_CHR},
- {NSC_NATID, 0, 0, fldoff(nwsstr, nws_vno), "victim", EF_NATION},
- {NSC_CHAR, 0, 0, fldoff(nwsstr, nws_ntm), "times", EF_BAD},
- {NSC_TIME, 0, 0, fldoff(nwsstr, nws_when), "time", EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+ {"actor", fldoff(nws_ano), NSC_NATID, 0, EF_NATION, 0},
+ {"action", fldoff(nws_vrb), NSC_UCHAR, 0, EF_NEWS_CHR, 0},
+ {"victim", fldoff(nws_vno), NSC_NATID, 0, EF_NATION, 0},
+ {"times", fldoff(nws_ntm), NSC_CHAR, 0, EF_BAD, 0},
+ {"time", fldoff(nws_when), NSC_TIME, 0, EF_BAD, 0},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr lost_ca[] = {
- /* no need for uid as long as it's not referenced from other tables */
- {NSC_NATID, 0, 0, fldoff(loststr, lost_owner), "owner", EF_NATION},
- {NSC_CHAR, 0, 0, fldoff(loststr, lost_type), "type", EF_TABLE},
- {NSC_SHORT, 0, 0, fldoff(loststr, lost_id), "id", EF_BAD},
- {NSC_XCOORD, 0, 0, fldoff(loststr, lost_x), "x", EF_BAD},
- {NSC_YCOORD, 0, 0, fldoff(loststr, lost_y), "y", EF_BAD},
- {NSC_TIME, 0, 0, fldoff(loststr, lost_timestamp), "timestamp", EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+#define CURSTR struct loststr
+ /* no need for uid as long as it's not referenced from other tables */
+ {"owner", fldoff(lost_owner), NSC_NATID, 0, EF_NATION, 0},
+ {"type", fldoff(lost_type), NSC_CHAR, 0, EF_TABLE, 0},
+ {"id", fldoff(lost_id), NSC_SHORT, 0, EF_BAD, 0},
+ {"x", fldoff(lost_x), NSC_XCOORD, 0, EF_BAD, 0},
+ {"y", fldoff(lost_y), NSC_YCOORD, 0, EF_BAD, 0},
+ {"timestamp", fldoff(lost_timestamp), NSC_TIME, 0, EF_BAD, 0},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr commodity_ca[] = {
- {NSC_SHORT, 0, 0, fldoff(comstr, com_uid), "uid", EF_COMM},
- {NSC_NATID, 0, 0, fldoff(comstr, com_owner), "owner", EF_NATION},
- {NSC_SITYPE(i_type), 0, 0, fldoff(comstr, com_type), "type", EF_ITEM},
- {NSC_INT, 0, 0, fldoff(comstr, com_amount), "amount", EF_BAD},
- {NSC_FLOAT, 0, 0, fldoff(comstr, com_price), "price", EF_BAD},
- {NSC_INT, 0, 0, fldoff(comstr, com_maxbidder), "maxbidder", EF_NATION},
- {NSC_TIME, 0, 0, fldoff(comstr, com_markettime), "markettime", EF_BAD},
+#define CURSTR struct comstr
+ {"uid", fldoff(com_uid), NSC_SHORT, 0, EF_COMM, 0},
+ {"owner", fldoff(com_owner), NSC_NATID, 0, EF_NATION, 0},
+ {"type", fldoff(com_type), NSC_SITYPE(i_type), 0, EF_ITEM, 0},
+ {"amount", fldoff(com_amount), NSC_INT, 0, EF_BAD, 0},
+ {"price", fldoff(com_price), NSC_FLOAT, 0, EF_BAD, 0},
+ {"maxbidder", fldoff(com_maxbidder), NSC_INT, 0, EF_NATION, 0},
+ {"markettime", fldoff(com_markettime), NSC_TIME, 0, EF_BAD, 0},
/* should let maxbidder access xbuy, ybuy, but can't express that: */
- {NSC_XCOORD, NSC_DEITY, 0, fldoff(comstr, com_x), "xbuy", EF_BAD},
- {NSC_XCOORD, NSC_DEITY, 0, fldoff(comstr, com_y), "ybuy", EF_BAD},
+ {"xbuy", fldoff(com_x), NSC_XCOORD, 0, EF_BAD, NSC_DEITY},
+ {"ybuy", fldoff(com_y), NSC_XCOORD, 0, EF_BAD, NSC_DEITY},
/* should let owner access xsell, ysell, but can't express that: */
- {NSC_XCOORD, NSC_DEITY, 0, fldoff(comstr, sell_x), "xsell", EF_BAD},
- {NSC_YCOORD, NSC_DEITY, 0, fldoff(comstr, sell_y), "ysell", EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+ {"xsell", fldoff(sell_x), NSC_XCOORD, 0, EF_BAD, NSC_DEITY},
+ {"ysell", fldoff(sell_y), NSC_YCOORD, 0, EF_BAD, NSC_DEITY},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr trade_ca[] = {
- {NSC_SHORT, 0, 0, fldoff(trdstr, trd_uid), "uid", EF_TRADE},
- {NSC_NATID, 0, 0, fldoff(trdstr, trd_owner), "owner", EF_NATION},
- {NSC_CHAR, 0, 0, fldoff(trdstr, trd_type), "type", EF_TABLE},
- {NSC_SHORT, 0, 0, fldoff(trdstr, trd_unitid), "unitid", EF_BAD},
- {NSC_LONG, 0, 0, fldoff(trdstr, trd_price), "price", EF_BAD},
- {NSC_INT, 0, 0, fldoff(trdstr, trd_maxbidder), "maxbidder", EF_NATION},
- {NSC_TIME, 0, 0, fldoff(trdstr, trd_markettime), "markettime", EF_BAD},
+#define CURSTR struct trdstr
+ {"uid", fldoff(trd_uid), NSC_SHORT, 0, EF_TRADE, 0},
+ {"owner", fldoff(trd_owner), NSC_NATID, 0, EF_NATION, 0},
+ {"type", fldoff(trd_type), NSC_CHAR, 0, EF_TABLE, 0},
+ {"unitid", fldoff(trd_unitid), NSC_SHORT, 0, EF_BAD, 0},
+ {"price", fldoff(trd_price), NSC_LONG, 0, EF_BAD, 0},
+ {"maxbidder", fldoff(trd_maxbidder), NSC_INT, 0, EF_NATION, 0},
+ {"markettime", fldoff(trd_markettime), NSC_TIME, 0, EF_BAD, 0},
/* should let maxbidder access xloc, yloc, but can't express that: */
- {NSC_XCOORD, NSC_DEITY, 0, fldoff(trdstr, trd_x), "xloc", EF_BAD},
- {NSC_YCOORD, NSC_DEITY, 0, fldoff(trdstr, trd_y), "yloc", EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+ {"xloc", fldoff(trd_x), NSC_XCOORD, 0, EF_BAD, NSC_DEITY},
+ {"yloc", fldoff(trd_y), NSC_YCOORD, 0, EF_BAD, NSC_DEITY},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr cou_ca[] = {
+#define CURSTR struct natstr
/*
* This is the owner's view, i.e. it applies only to the own
* nation. The public view nat_ca[], which applies to all
* happiness available, but we can't express the obfuscation
* necessary for foreign levels.
*/
- {NSC_NATID, 0, 0, fldoff(natstr, nat_cnum), "cnum", EF_NATION},
- {NSC_SITYPE(nat_status), NSC_EXTRA, 0, fldoff(natstr, nat_stat),
- "stat", EF_NATION_STATUS},
- {NSC_STRINGY, NSC_EXTRA, 20, fldoff(natstr, nat_cnam), "cname", EF_BAD},
- {NSC_STRINGY, NSC_DEITY | NSC_EXTRA, 20, fldoff(natstr, nat_pnam),
- "passwd", EF_BAD},
- {NSC_STRINGY, 0, 32, fldoff(natstr, nat_hostaddr), "ip", EF_BAD},
- {NSC_STRINGY, 0, 512, fldoff(natstr, nat_hostname), "hostname", EF_BAD},
- {NSC_STRINGY, 0, 32, fldoff(natstr, nat_userid), "userid", EF_BAD},
- {NSC_XCOORD, 0, 0, fldoff(natstr, nat_xcap), "xcap", EF_BAD},
- {NSC_YCOORD, 0, 0, fldoff(natstr, nat_ycap), "ycap", EF_BAD},
- {NSC_XCOORD, NSC_DEITY | NSC_EXTRA, 0, fldoff(natstr, nat_xorg),
- "xorg", EF_BAD},
- {NSC_YCOORD, NSC_DEITY | NSC_EXTRA, 0, fldoff(natstr, nat_yorg),
- "yorg", EF_BAD},
- {NSC_CHAR, 0, 0, fldoff(natstr, nat_dayno), "dayno", EF_BAD},
- {NSC_CHAR, 0, 0, fldoff(natstr, nat_update), "update", EF_BAD},
- {NSC_USHORT, 0, 0, fldoff(natstr, nat_tgms), "tgms", EF_BAD},
- {NSC_USHORT, 0, 0, fldoff(natstr, nat_ann), "ann", EF_BAD},
- {NSC_USHORT, 0, 0, fldoff(natstr, nat_minused), "minused", EF_BAD},
- {NSC_SHORT, 0, 0, fldoff(natstr, nat_btu), "btu", EF_BAD},
- {NSC_SHORT, 0, 0, fldoff(natstr, nat_access), "access", EF_BAD},
- {NSC_LONG, 0, 0, fldoff(natstr, nat_reserve), "milreserve", EF_BAD},
- {NSC_LONG, 0, 0, fldoff(natstr, nat_money), "money", EF_BAD},
- {NSC_TIME, 0, 0, fldoff(natstr, nat_last_login), "login", EF_BAD},
- {NSC_TIME, 0, 0, fldoff(natstr, nat_last_logout), "logout", EF_BAD},
- {NSC_TIME, 0, 0, fldoff(natstr, nat_newstim), "newstim", EF_BAD},
- {NSC_TIME, 0, 0, fldoff(natstr, nat_annotim), "annotim", EF_BAD},
- {NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_TLEV]), "tech", EF_BAD},
- {NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_RLEV]), "research", EF_BAD},
- {NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_ELEV]), "education",
- EF_BAD},
- {NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_HLEV]), "happiness",
- EF_BAD},
- {NSC_HIDDEN, NSC_EXTRA, MAXNOC, fldoff(natstr, nat_relate), "relations",
- EF_NATION_RELATIONS},
+ {"cnum", fldoff(nat_cnum), NSC_NATID, 0, EF_NATION, 0},
+ {"stat", fldoff(nat_stat), NSC_SITYPE(nat_status), 0, EF_NATION_STATUS, NSC_EXTRA},
+ {"cname", fldoff(nat_cnam), NSC_STRINGY, 20, EF_BAD, NSC_EXTRA},
+ {"passwd", fldoff(nat_pnam), NSC_STRINGY, 20, EF_BAD, NSC_DEITY | NSC_EXTRA},
+ {"ip", fldoff(nat_hostaddr), NSC_STRINGY, 32, EF_BAD, 0},
+ {"hostname", fldoff(nat_hostname), NSC_STRINGY, 512, EF_BAD, 0},
+ {"userid", fldoff(nat_userid), NSC_STRINGY, 32, EF_BAD, 0},
+ {"xcap", fldoff(nat_xcap), NSC_XCOORD, 0, EF_BAD, 0},
+ {"ycap", fldoff(nat_ycap), NSC_YCOORD, 0, EF_BAD, 0},
+ {"xorg", fldoff(nat_xorg), NSC_XCOORD, 0, EF_BAD, NSC_DEITY | NSC_EXTRA},
+ {"yorg", fldoff(nat_yorg), NSC_YCOORD, 0, EF_BAD, NSC_DEITY | NSC_EXTRA},
+ {"dayno", fldoff(nat_dayno), NSC_CHAR, 0, EF_BAD, 0},
+ {"update", fldoff(nat_update), NSC_CHAR, 0, EF_BAD, 0},
+ {"tgms", fldoff(nat_tgms), NSC_USHORT, 0, EF_BAD, 0},
+ {"ann", fldoff(nat_ann), NSC_USHORT, 0, EF_BAD, 0},
+ {"minused", fldoff(nat_minused), NSC_USHORT, 0, EF_BAD, 0},
+ {"btu", fldoff(nat_btu), NSC_SHORT, 0, EF_BAD, 0},
+ {"access", fldoff(nat_access), NSC_SHORT, 0, EF_BAD, 0},
+ {"milreserve", fldoff(nat_reserve), NSC_LONG, 0, EF_BAD, 0},
+ {"money", fldoff(nat_money), NSC_LONG, 0, EF_BAD, 0},
+ {"login", fldoff(nat_last_login), NSC_TIME, 0, EF_BAD, 0},
+ {"logout", fldoff(nat_last_logout), NSC_TIME, 0, EF_BAD, 0},
+ {"newstim", fldoff(nat_newstim), NSC_TIME, 0, EF_BAD, 0},
+ {"annotim", fldoff(nat_annotim), NSC_TIME, 0, EF_BAD, 0},
+ {"tech", fldoff(nat_level[NAT_TLEV]), NSC_FLOAT, 0, EF_BAD, 0},
+ {"research", fldoff(nat_level[NAT_RLEV]), NSC_FLOAT, 0, EF_BAD, 0},
+ {"education", fldoff(nat_level[NAT_ELEV]), NSC_FLOAT, 0, EF_BAD, 0},
+ {"happiness", fldoff(nat_level[NAT_HLEV]), NSC_FLOAT, 0, EF_BAD, 0},
+ {"relations", fldoff(nat_relate), NSC_HIDDEN, MAXNOC, EF_NATION_RELATIONS, NSC_EXTRA},
/* mortals know there's contact (relations show), but not how strong */
- {NSC_UCHAR, NSC_DEITY | NSC_EXTRA, MAXNOC, fldoff(natstr, nat_contact),
- "contacts", EF_BAD},
- {NSC_UCHAR, NSC_EXTRA | NSC_BITS, MAXNOC, fldoff(natstr, nat_rejects),
- "rejects", EF_NATION_REJECTS},
- {NSC_LONG, NSC_BITS, 0, fldoff(natstr, nat_flags), "flags",
- EF_NATION_FLAGS},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+ {"contacts", fldoff(nat_contact), NSC_UCHAR, MAXNOC, EF_BAD, NSC_DEITY | NSC_EXTRA},
+ {"rejects", fldoff(nat_rejects), NSC_UCHAR, MAXNOC, EF_NATION_REJECTS, NSC_EXTRA | NSC_BITS},
+ {"flags", fldoff(nat_flags), NSC_LONG, 0, EF_NATION_FLAGS, NSC_BITS},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr nat_ca[sizeof(cou_ca) / sizeof(*cou_ca)];
/* initialized by nsc_init() */
struct castr realm_ca[] = {
+#define CURSTR struct realmstr
/* uid is encoded in cnum, realm */
- {NSC_NATID, NSC_CONST, 0, fldoff(realmstr, r_cnum), "cnum", EF_NATION},
- {NSC_USHORT, NSC_CONST, 0, fldoff(realmstr, r_realm), "realm", EF_BAD},
- {NSC_SHORT, 0, 0, fldoff(realmstr, r_xl), "xl", EF_BAD},
- {NSC_SHORT, 0, 0, fldoff(realmstr, r_xh), "xh", EF_BAD},
- {NSC_SHORT, 0, 0, fldoff(realmstr, r_yl), "yl", EF_BAD},
- {NSC_SHORT, 0, 0, fldoff(realmstr, r_yh), "yh", EF_BAD},
- {NSC_TIME, NSC_EXTRA, 0, fldoff(realmstr, r_timestamp), "timestamp",
- EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+ {"cnum", fldoff(r_cnum), NSC_NATID, 0, EF_NATION, NSC_CONST},
+ {"realm", fldoff(r_realm), NSC_USHORT, 0, EF_BAD, NSC_CONST},
+ {"xl", fldoff(r_xl), NSC_SHORT, 0, EF_BAD, 0},
+ {"xh", fldoff(r_xh), NSC_SHORT, 0, EF_BAD, 0},
+ {"yl", fldoff(r_yl), NSC_SHORT, 0, EF_BAD, 0},
+ {"yh", fldoff(r_yh), NSC_SHORT, 0, EF_BAD, 0},
+ {"timestamp", fldoff(r_timestamp), NSC_TIME, 0, EF_BAD, NSC_EXTRA},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr game_ca[] = {
+#define CURSTR struct gamestr
/* no need for uid */
- {NSC_CHAR, 0, 0, offsetof(struct gamestr, game_upd_disable),
- "upd_disable", EF_BAD},
- {NSC_SHORT, 0, 0, offsetof(struct gamestr, game_turn), "turn", EF_BAD},
- {NSC_SHORT, NSC_DEITY, 0, offsetof(struct gamestr, game_tick), "tick",
- EF_BAD},
- {NSC_TIME, NSC_DEITY, 0, offsetof(struct gamestr, game_rt), "rt", EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+ {"upd_disable", fldoff(game_upd_disable), NSC_CHAR, 0, EF_BAD, 0},
+ {"turn", fldoff(game_turn), NSC_SHORT, 0, EF_BAD, 0},
+ {"tick", fldoff(game_tick), NSC_SHORT, 0, EF_BAD, NSC_DEITY},
+ {"rt", fldoff(game_rt), NSC_TIME, 0, EF_BAD, NSC_DEITY},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr intrchr_ca[] = {
+#define CURSTR struct sctintrins
/* no need for uid as long as it's not referenced from other tables */
- {NSC_STRING, NSC_CONST, 0, offsetof(struct sctintrins, in_name), "name",
- EF_BAD},
- {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_lcms), "lcms", EF_BAD},
- {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_hcms), "hcms", EF_BAD},
- {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_dcost), "dcost", EF_BAD},
- {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_mcost), "mcost", EF_BAD},
- {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_enable), "enable",
- EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+ {"name", fldoff(in_name), NSC_STRING, 0, EF_BAD, NSC_CONST},
+ {"lcms", fldoff(in_lcms), NSC_UCHAR, 0, EF_BAD, 0},
+ {"hcms", fldoff(in_hcms), NSC_UCHAR, 0, EF_BAD, 0},
+ {"dcost", fldoff(in_dcost), NSC_UCHAR, 0, EF_BAD, 0},
+ {"mcost", fldoff(in_mcost), NSC_UCHAR, 0, EF_BAD, 0},
+ {"enable", fldoff(in_enable), NSC_UCHAR, 0, EF_BAD, 0},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr rpt_ca[] = {
- {NSC_CHAR, 0, 0, offsetof(struct rptstr, r_uid), "uid", EF_NEWS_CHR},
- {NSC_STRING, 0, NUM_RPTS, offsetof(struct rptstr, r_newstory), "newstory",
- EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct rptstr, r_good_will), "good_will", EF_BAD},
- {NSC_INT, 0, 0, offsetof(struct rptstr, r_newspage), "newspage",
- EF_PAGE_HEADINGS},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+#define CURSTR struct rptstr
+ {"uid", fldoff(r_uid), NSC_CHAR, 0, EF_NEWS_CHR, 0},
+ {"newstory", fldoff(r_newstory), NSC_STRING, NUM_RPTS, EF_BAD, 0},
+ {"good_will", fldoff(r_good_will), NSC_INT, 0, EF_BAD, 0},
+ {"newspage", fldoff(r_newspage), NSC_INT, 0, EF_PAGE_HEADINGS, 0},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr update_ca[] = {
- {NSC_TIME, 0, 0, 0, "time", EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+ {"time", 0, NSC_TIME, 0, EF_BAD, 0},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
};
struct castr empfile_ca[] = {
- {NSC_INT, 0, 0, offsetof(struct empfile, uid), "uid", EF_TABLE},
- {NSC_STRING, NSC_CONST, 0, offsetof(struct empfile, name), "name", EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+#define CURSTR struct empfile
+ {"uid", fldoff(uid), NSC_INT, 0, EF_TABLE, 0},
+ {"name", fldoff(name), NSC_STRING, 0, EF_BAD, NSC_CONST},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr symbol_ca[] = {
+#define CURSTR struct symbol
/*
* value is is const because it has to match what is compiled into
* the server. name is const because clients key on it.
*/
- {NSC_INT, NSC_CONST, 0, offsetof(struct symbol, value), "value", EF_BAD},
- {NSC_STRING, NSC_CONST, 0, offsetof(struct symbol, name), "name", EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+ {"value", fldoff(value), NSC_INT, 0, EF_BAD, NSC_CONST},
+ {"name", fldoff(name), NSC_STRING, 0, EF_BAD, NSC_CONST},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
struct castr mdchr_ca[] = {
+#define CURSTR struct castr
/* no need for uid */
/* name must come first, clients may rely on it */
- {NSC_STRING, NSC_CONST, 0, offsetof(struct castr, ca_name), "name",
- EF_BAD},
- {NSC_CHAR, NSC_CONST, 0, offsetof(struct castr, ca_type), "type",
- EF_META_TYPE},
- {NSC_UCHAR, NSC_CONST | NSC_BITS, 0, offsetof(struct castr, ca_flags),
- "flags", EF_META_FLAGS},
- {NSC_USHORT, NSC_CONST, 0, offsetof(struct castr, ca_len), "len",
- EF_BAD},
- {NSC_INT, NSC_CONST, 0, offsetof(struct castr, ca_table), "table",
- EF_BAD},
- {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+ {"name", fldoff(ca_name), NSC_STRING, 0, EF_BAD, NSC_CONST},
+ {"type", fldoff(ca_type), NSC_CHAR, 0, EF_META_TYPE, NSC_CONST},
+ {"flags", fldoff(ca_flags), NSC_UCHAR, 0, EF_META_FLAGS, NSC_CONST | NSC_BITS},
+ {"len", fldoff(ca_len), NSC_USHORT, 0, EF_BAD, NSC_CONST},
+ {"table", fldoff(ca_table), NSC_INT, 0, EF_BAD, NSC_CONST},
+ {NULL, 0, NSC_NOTYPE, 0, EF_BAD, 0}
+#undef CURSTR
};
void