Selector rewrite: values other than long, interpret identifiers

according to context, to make `lstat * ?type#spy&spy>1' work.  Closes
bug#825363, #905809, #905814 and #922968.
(nsc_type, packed_nsc_type, nsc_cat, packed_nsc_cat, nsc_flags): New.
(valstr): New.  Old code encoded values in type long, which was
somewhat hard to read and could only support signed integer values.
(nscstr): Redesign.  Use valstr.  Typed operator.
(castr): Split ca_code into ca_type, ca_flags, ca_off.  Tables
changed.
(nstr_comp, nstr_exec): Redesign and rewrite.  Callers changed.  They
used the old design incorrectly, which let players smash the stack
by supplying more than NCOND conditions.
(encode, nstr_comp_val, decode, nstr_exec_val): Rename, redesign, and
rewrite.  Callers changed.
(nstr_coerce_val): New.
(var_ca, sect_ca, ship_ca, land_ca): Checking both var_ca[] and the
object's ca complicates proper recognition of unique abbreviations.
Copy contents of var_ca[] into the ca of objects, remove var_ca[].

(surv): Reject values with category other than NSC_OFF and types that
can't be coerced to NSC_LONG.  Old code happily passed values with
category NSC_VAL to code_char().  The previous version interpreted
them correctly, but earlier versions interpreted them as NSC_OFF, then
logged `bad type in decode: 0' and evaluated them into zero.

(code_char): Used to test category NSC_VAR to decide whether to
display tens or hundreds.  NSC_VAR no longer exists.  Test type
instead.  Makes more sense anyway.
This commit is contained in:
Markus Armbruster 2004-04-02 19:02:12 +00:00
parent 47c8a32ae3
commit 4366c5ac6e
13 changed files with 726 additions and 544 deletions

View file

@ -25,9 +25,10 @@
*
* ---
*
* nscglb.c: Empire selection global structures
* nsc.c: Empire selection global structures
*
* Known contributors to this file:
* Markus Armbruster, 2004
*
*/
@ -51,300 +52,270 @@
#include "commodity.h"
#include "lost.h"
struct castr var_ca[] = {
{NSC_VAR | V_CIVIL, "civil", 0},
{NSC_VAR | V_MILIT, "milit", 0},
{NSC_VAR | V_SHELL, "shell", 0},
{NSC_VAR | V_GUN, "gun", 0},
{NSC_VAR | V_PETROL, "petrol", 0},
{NSC_VAR | V_IRON, "iron", 0},
{NSC_VAR | V_DUST, "dust", 0},
{NSC_VAR | V_BAR, "bar", 0},
{NSC_VAR | V_FOOD, "food", 0},
{NSC_VAR | V_OIL, "oil", 0},
{NSC_VAR | V_LCM, "lcm", 0},
{NSC_VAR | V_HCM, "hcm", 0},
{NSC_VAR | V_UW, "uw", 0},
{NSC_VAR | V_RAD, "rad", 0},
{0, 0, 0}
};
#define NSC_IELT(name, pfx, sfx, base, itype) \
{NSC_USHORT, 0, 0, ((base) + (itype)*sizeof(u_short)), \
sizeof(sfx) == 1 ? name : pfx sfx}
#define NSC_IVEC(base, sfx) \
NSC_IELT("civil", "c", sfx, base, I_CIVIL), \
NSC_IELT("milit", "m", sfx, base, I_MILIT), \
NSC_IELT("shell", "s", sfx, base, I_SHELL), \
NSC_IELT("gun", "g", sfx, base, I_GUN), \
NSC_IELT("petrol", "p", sfx, base, I_PETROL), \
NSC_IELT("iron", "i", sfx, base, I_IRON), \
NSC_IELT("dust", "d", sfx, base, I_DUST), \
NSC_IELT("bar", "b", sfx, base, I_BAR), \
NSC_IELT("food", "f", sfx, base, I_FOOD), \
NSC_IELT("oil", "o", sfx, base, I_OIL), \
NSC_IELT("lcm", "l", sfx, base, I_LCM), \
NSC_IELT("hcm", "h", sfx, base, I_HCM), \
NSC_IELT("uw", "u", sfx, base, I_UW), \
NSC_IELT("rad", "r", sfx, base, I_RAD)
struct castr sect_ca[] = {
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_own), "owner", 0},
{NSC_XCOORD | NSC_OFF | fldoff(sctstr, sct_x), "xloc", 0},
{NSC_YCOORD | NSC_OFF | fldoff(sctstr, sct_y), "yloc", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_type), "des", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_effic), "effic", 0},
{NSC_SHORT | NSC_OFF | fldoff(sctstr, sct_mobil), "mobil", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_terr), "terr", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_terr), "terr0", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_terr1), "terr1", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_terr2), "terr2", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_terr3), "terr3", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_work), "work", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_coastal), "coastal", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_newtype), "newdes", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_min), "min", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_gmin), "gold", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_fertil), "fert", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_oil), "ocontent", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_uran), "uran", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_oldown), "oldown", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_off), "off", 0},
{NSC_XCOORD | NSC_OFF | fldoff(sctstr, sct_dist_x), "xdist", 0},
{NSC_YCOORD | NSC_OFF | fldoff(sctstr, sct_dist_y), "ydist", 0},
{NSC_SHORT | NSC_OFF | fldoff(sctstr, sct_avail), "avail", 0},
#define distoff(itype) (fldoff(sctstr, sct_dist) + (itype)*sizeof(u_short))
{NSC_USHORT | NSC_OFF | distoff(I_CIVIL), "c_dist", 0},
{NSC_USHORT | NSC_OFF | distoff(I_MILIT), "m_dist", 0},
{NSC_USHORT | NSC_OFF | distoff(I_UW), "u_dist", 0},
{NSC_USHORT | NSC_OFF | distoff(I_SHELL), "s_dist", 0},
{NSC_USHORT | NSC_OFF | distoff(I_GUN), "g_dist", 0},
{NSC_USHORT | NSC_OFF | distoff(I_PETROL), "p_dist", 0},
{NSC_USHORT | NSC_OFF | distoff(I_IRON), "i_dist", 0},
{NSC_USHORT | NSC_OFF | distoff(I_DUST), "d_dist", 0},
{NSC_USHORT | NSC_OFF | distoff(I_BAR), "b_dist", 0},
{NSC_USHORT | NSC_OFF | distoff(I_FOOD), "f_dist", 0},
{NSC_USHORT | NSC_OFF | distoff(I_OIL), "o_dist", 0},
{NSC_USHORT | NSC_OFF | distoff(I_LCM), "l_dist", 0},
{NSC_USHORT | NSC_OFF | distoff(I_HCM), "h_dist", 0},
{NSC_USHORT | NSC_OFF | distoff(I_RAD), "r_dist", 0},
#undef distoff
#define deloff(itype) (fldoff(sctstr, sct_del) + (itype)*sizeof(u_short))
{NSC_USHORT | NSC_OFF | deloff(I_CIVIL), "c_del", 0},
{NSC_USHORT | NSC_OFF | deloff(I_MILIT), "m_del", 0},
{NSC_USHORT | NSC_OFF | deloff(I_UW), "u_del", 0},
{NSC_USHORT | NSC_OFF | deloff(I_SHELL), "s_del", 0},
{NSC_USHORT | NSC_OFF | deloff(I_GUN), "g_del", 0},
{NSC_USHORT | NSC_OFF | deloff(I_PETROL), "p_del", 0},
{NSC_USHORT | NSC_OFF | deloff(I_IRON), "i_del", 0},
{NSC_USHORT | NSC_OFF | deloff(I_DUST), "d_del", 0},
{NSC_USHORT | NSC_OFF | deloff(I_BAR), "b_del", 0},
{NSC_USHORT | NSC_OFF | deloff(I_FOOD), "f_del", 0},
{NSC_USHORT | NSC_OFF | deloff(I_OIL), "o_del", 0},
{NSC_USHORT | NSC_OFF | deloff(I_LCM), "l_del", 0},
{NSC_USHORT | NSC_OFF | deloff(I_HCM), "h_del", 0},
{NSC_USHORT | NSC_OFF | deloff(I_RAD), "r_del", 0},
#undef deloff
{NSC_DEITY | NSC_USHORT | NSC_OFF | fldoff(sctstr, sct_mines), "mines", 0},
{NSC_DEITY | NSC_USHORT | NSC_OFF | fldoff(sctstr, sct_pstage), "pstage", 0},
{NSC_DEITY | NSC_USHORT | NSC_OFF | fldoff(sctstr, sct_ptime), "ptime", 0},
{NSC_DEITY | NSC_USHORT | NSC_OFF | fldoff(sctstr, sct_che), "che", 0},
{NSC_DEITY | NSC_USHORT | NSC_OFF | fldoff(sctstr, sct_che_target), "che_target", 0},
{NSC_USHORT | NSC_OFF | fldoff(sctstr, sct_fallout), "fallout", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_road), "road", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_rail), "rail", 0},
{NSC_UCHAR | NSC_OFF | fldoff(sctstr, sct_defense), "dfense", 0},
{NSC_TIME | NSC_OFF | fldoff(sctstr, sct_timestamp), "timestamp", 0},
{0, 0, 0}
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_own), "owner"},
{NSC_XCOORD, 0, 0, fldoff(sctstr, sct_x), "xloc"},
{NSC_YCOORD, 0, 0, fldoff(sctstr, sct_y), "yloc"},
{NSC_TYPEID, 0, 0, fldoff(sctstr, sct_type), "des"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_effic), "effic"},
{NSC_SHORT, 0, 0, fldoff(sctstr, sct_mobil), "mobil"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr), "terr"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr), "terr0"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr1), "terr1"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr2), "terr2"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr3), "terr3"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_work), "work"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_coastal), "coastal"},
{NSC_TYPEID, 0, 0, fldoff(sctstr, sct_newtype), "newdes"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_min), "min"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_gmin), "gold"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_fertil), "fert"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_oil), "ocontent"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_uran), "uran"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_oldown), "oldown"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_off), "off"},
{NSC_XCOORD, 0, 0, fldoff(sctstr, sct_dist_x), "xdist"},
{NSC_YCOORD, 0, 0, fldoff(sctstr, sct_dist_y), "ydist"},
{NSC_SHORT, 0, 0, fldoff(sctstr, sct_avail), "avail"},
NSC_IVEC(fldoff(sctstr, sct_item), ""),
NSC_IVEC(fldoff(sctstr, sct_dist), "_dist"),
NSC_IVEC(fldoff(sctstr, sct_del), "_del"),
{NSC_USHORT, NSC_DEITY, 0, fldoff(sctstr, sct_mines), "mines"},
{NSC_USHORT, NSC_DEITY, 0, fldoff(sctstr, sct_pstage), "pstage"},
{NSC_USHORT, NSC_DEITY, 0, fldoff(sctstr, sct_ptime), "ptime"},
{NSC_USHORT, NSC_DEITY, 0, fldoff(sctstr, sct_che), "che"},
{NSC_USHORT, NSC_DEITY, 0, fldoff(sctstr, sct_che_target), "che_target"},
{NSC_USHORT, 0, 0, fldoff(sctstr, sct_fallout), "fallout"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_road), "road"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_rail), "rail"},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_defense), "dfense"},
{NSC_TIME, 0, 0, fldoff(sctstr, sct_timestamp), "timestamp"},
{NSC_NOTYPE, 0, 0, 0, NULL}
};
#define NSC_GENITEM \
{ NSC_UCHAR | NSC_OFF | fldoff(genitem, own), "owner", 0},\
{ NSC_SHORT | NSC_OFF | fldoff(genitem, uid), "uid", 0},\
{ NSC_XCOORD | NSC_OFF | fldoff(genitem, x), "xloc", 0},\
{ NSC_YCOORD | NSC_OFF | fldoff(genitem, y), "yloc", 0},\
{ NSC_UCHAR | NSC_OFF | fldoff(genitem, type), "type", 0},\
{ NSC_UCHAR | NSC_OFF | fldoff(genitem, effic), "effic", 0},\
{ NSC_CHAR | NSC_OFF | fldoff(genitem, mobil), "mobil", 0},\
{ NSC_SHORT | NSC_OFF | fldoff(genitem, tech), "tech", 0},\
{ NSC_CHAR | NSC_OFF | fldoff(genitem, group), "group", 0},\
{ NSC_XCOORD | NSC_OFF | fldoff(genitem, opx), "opx", 0},\
{ NSC_YCOORD | NSC_OFF | fldoff(genitem, opy), "opy", 0},\
{ NSC_SHORT | NSC_OFF | fldoff(genitem, mission), "mission", 0}
struct castr genitem_ca[] = {
NSC_GENITEM,
{0, 0, 0}
};
{ NSC_UCHAR, 0, 0, fldoff(genitem, own), "owner"}, \
{ NSC_SHORT, 0, 0, fldoff(genitem, uid), "uid"}, \
{ NSC_XCOORD, 0, 0, fldoff(genitem, x), "xloc"}, \
{ NSC_YCOORD, 0, 0, fldoff(genitem, y), "yloc"}, \
{ NSC_TYPEID, 0, 0, fldoff(genitem, type), "type"}, \
{ NSC_UCHAR, 0, 0, fldoff(genitem, effic), "effic"}, \
{ NSC_CHAR , 0, 0, fldoff(genitem, mobil), "mobil"}, \
{ NSC_SHORT, 0, 0, fldoff(genitem, tech), "tech"}, \
{ NSC_CHAR, 0, 0, fldoff(genitem, group), "group"}, \
{ NSC_XCOORD, 0, 0, fldoff(genitem, opx), "opx"}, \
{ NSC_YCOORD, 0, 0, fldoff(genitem, opy), "opy"}, \
{ NSC_SHORT, 0, 0, fldoff(genitem, mission), "mission"}
struct castr ship_ca[] = {
NSC_GENITEM,
{NSC_CHAR | NSC_OFF | fldoff(shpstr, shp_fleet), "fleet", 0},
{NSC_CHAR | NSC_OFF | fldoff(shpstr, shp_nplane), "nplane", 0},
{NSC_TIME | NSC_OFF | fldoff(shpstr, shp_timestamp), "timestamp", 0},
{NSC_UCHAR | NSC_OFF | fldoff(shpstr, shp_fuel), "fuel", 0},
{NSC_UCHAR | NSC_OFF | fldoff(shpstr, shp_nxlight), "nxlight", 0},
{NSC_UCHAR | NSC_OFF | fldoff(shpstr, shp_nchoppers), "nchoppers", 0},
{NSC_UCHAR | NSC_OFF | fldoff(shpstr, shp_autonav), "autonav", 0},
{NSC_DEITY | NSC_USHORT | NSC_OFF | fldoff(shpstr, shp_pstage), "pstage", 0},
{NSC_DEITY | NSC_USHORT | NSC_OFF | fldoff(shpstr, shp_ptime), "ptime", 0},
{0, 0, 0}
{NSC_CHAR, 0, 0, fldoff(shpstr, shp_fleet), "fleet"},
{NSC_CHAR, 0, 0, fldoff(shpstr, shp_nplane), "nplane"},
{NSC_TIME, 0, 0, fldoff(shpstr, shp_timestamp), "timestamp"},
{NSC_UCHAR, 0, 0, fldoff(shpstr, shp_fuel), "fuel"},
{NSC_UCHAR, 0, 0, fldoff(shpstr, shp_nxlight), "nxlight"},
{NSC_UCHAR, 0, 0, fldoff(shpstr, shp_nchoppers), "nchoppers"},
{NSC_UCHAR, 0, 0, fldoff(shpstr, shp_autonav), "autonav"},
{NSC_USHORT, NSC_DEITY, 0, fldoff(shpstr, shp_pstage), "pstage"},
{NSC_USHORT, NSC_DEITY, 0, fldoff(shpstr, shp_ptime), "ptime"},
NSC_IVEC(fldoff(shpstr, shp_item), ""),
{NSC_NOTYPE, 0, 0, 0, NULL}
};
struct castr plane_ca[] = {
NSC_GENITEM,
{NSC_UCHAR | NSC_OFF | fldoff(plnstr, pln_wing), "wing", 0},
{NSC_UCHAR | NSC_OFF | fldoff(plnstr, pln_range), "range", 0},
{NSC_SHORT | NSC_OFF | fldoff(plnstr, pln_ship), "ship", 0},
{NSC_UCHAR | NSC_OFF | fldoff(plnstr, pln_att), "att", 0},
{NSC_UCHAR | NSC_OFF | fldoff(plnstr, pln_def), "def", 0},
{NSC_UCHAR | NSC_OFF | fldoff(plnstr, pln_harden), "harden", 0},
{NSC_UCHAR | NSC_OFF | fldoff(plnstr, pln_nuketype), "nuketype", 0},
{NSC_UCHAR | NSC_OFF | fldoff(plnstr, pln_flags), "flags", 0},
{NSC_SHORT | NSC_OFF | fldoff(plnstr, pln_land), "land", 0},
{NSC_TIME | NSC_OFF | fldoff(plnstr, pln_timestamp), "timestamp", 0},
{0, 0, 0}
{NSC_UCHAR, 0, 0, fldoff(plnstr, pln_wing), "wing"},
{NSC_UCHAR, 0, 0, fldoff(plnstr, pln_range), "range"},
{NSC_SHORT, 0, 0, fldoff(plnstr, pln_ship), "ship"},
{NSC_UCHAR, 0, 0, fldoff(plnstr, pln_att), "att"},
{NSC_UCHAR, 0, 0, fldoff(plnstr, pln_def), "def"},
{NSC_UCHAR, 0, 0, fldoff(plnstr, pln_harden), "harden"},
{NSC_UCHAR, 0, 0, fldoff(plnstr, pln_nuketype), "nuketype"},
{NSC_UCHAR, 0, 0, fldoff(plnstr, pln_flags), "flags"},
{NSC_SHORT, 0, 0, fldoff(plnstr, pln_land), "land"},
{NSC_TIME, 0, 0, fldoff(plnstr, pln_timestamp), "timestamp"},
{NSC_NOTYPE, 0, 0, 0, NULL}
};
struct castr land_ca[] = {
NSC_GENITEM,
{NSC_CHAR | NSC_OFF | fldoff(lndstr, lnd_army), "army", 0},
{NSC_SHORT | NSC_OFF | fldoff(lndstr, lnd_ship), "ship", 0},
{NSC_SHORT | NSC_OFF | fldoff(lndstr, lnd_land), "land", 0},
{NSC_CHAR | NSC_OFF | fldoff(lndstr, lnd_harden), "harden", 0},
{NSC_SHORT | NSC_OFF | fldoff(lndstr, lnd_retreat), "retreat", 0},
{NSC_UCHAR | NSC_OFF | fldoff(lndstr, lnd_fuel), "fuel", 0},
{NSC_UCHAR | NSC_OFF | fldoff(lndstr, lnd_nxlight), "nxlight", 0},
{NSC_DEITY | NSC_USHORT | NSC_OFF | fldoff(lndstr, lnd_pstage), "pstage", 0},
{NSC_DEITY | NSC_USHORT | NSC_OFF | fldoff(lndstr, lnd_ptime), "ptime", 0},
{NSC_FLOAT | NSC_OFF | fldoff(lndstr, lnd_att), "att", 0},
{NSC_FLOAT | NSC_OFF | fldoff(lndstr, lnd_def), "def", 0},
{NSC_INT | NSC_OFF | fldoff(lndstr, lnd_vul), "vul", 0},
{NSC_INT | NSC_OFF | fldoff(lndstr, lnd_spd), "spd", 0},
{NSC_INT | NSC_OFF | fldoff(lndstr, lnd_vis), "vis", 0},
{NSC_INT | NSC_OFF | fldoff(lndstr, lnd_spy), "spy", 0},
{NSC_INT | NSC_OFF | fldoff(lndstr, lnd_rad), "rad", 0},
{NSC_INT | NSC_OFF | fldoff(lndstr, lnd_frg), "frg", 0},
{NSC_INT | NSC_OFF | fldoff(lndstr, lnd_acc), "acc", 0},
{NSC_INT | NSC_OFF | fldoff(lndstr, lnd_dam), "dam", 0},
{NSC_INT | NSC_OFF | fldoff(lndstr, lnd_ammo), "ammo", 0},
{NSC_INT | NSC_OFF | fldoff(lndstr, lnd_aaf), "aaf", 0},
{NSC_UCHAR | NSC_OFF | fldoff(lndstr, lnd_fuelc), "fuelc", 0},
{NSC_UCHAR | NSC_OFF | fldoff(lndstr, lnd_fuelu), "fuelu", 0},
{NSC_UCHAR | NSC_OFF | fldoff(lndstr, lnd_maxlight), "maxlight", 0},
{NSC_TIME | NSC_OFF | fldoff(lndstr, lnd_timestamp), "timestamp", 0},
{0, 0, 0}
{NSC_CHAR, 0, 0, fldoff(lndstr, lnd_army), "army"},
{NSC_SHORT, 0, 0, fldoff(lndstr, lnd_ship), "ship"},
{NSC_SHORT, 0, 0, fldoff(lndstr, lnd_land), "land"},
{NSC_CHAR, 0, 0, fldoff(lndstr, lnd_harden), "harden"},
{NSC_SHORT, 0, 0, fldoff(lndstr, lnd_retreat), "retreat"},
{NSC_UCHAR, 0, 0, fldoff(lndstr, lnd_fuel), "fuel"},
{NSC_UCHAR, 0, 0, fldoff(lndstr, lnd_nxlight), "nxlight"},
NSC_IVEC(fldoff(lndstr, lnd_item), ""),
{NSC_USHORT, NSC_DEITY, 0, fldoff(lndstr, lnd_pstage), "pstage"},
{NSC_USHORT, NSC_DEITY, 0, fldoff(lndstr, lnd_ptime), "ptime"},
{NSC_FLOAT, 0, 0, fldoff(lndstr, lnd_att), "att"},
{NSC_FLOAT, 0, 0, fldoff(lndstr, lnd_def), "def"},
{NSC_INT, 0, 0, fldoff(lndstr, lnd_vul), "vul"},
{NSC_INT, 0, 0, fldoff(lndstr, lnd_spd), "spd"},
{NSC_INT, 0, 0, fldoff(lndstr, lnd_vis), "vis"},
{NSC_INT, 0, 0, fldoff(lndstr, lnd_spy), "spy"},
{NSC_INT, 0, 0, fldoff(lndstr, lnd_rad), "rad"},
{NSC_INT, 0, 0, fldoff(lndstr, lnd_frg), "frg"},
{NSC_INT, 0, 0, fldoff(lndstr, lnd_acc), "acc"},
{NSC_INT, 0, 0, fldoff(lndstr, lnd_dam), "dam"},
{NSC_INT, 0, 0, fldoff(lndstr, lnd_ammo), "ammo"},
{NSC_INT, 0, 0, fldoff(lndstr, lnd_aaf), "aaf"},
{NSC_UCHAR, 0, 0, fldoff(lndstr, lnd_fuelc), "fuelc"},
{NSC_UCHAR, 0, 0, fldoff(lndstr, lnd_fuelu), "fuelu"},
{NSC_UCHAR, 0, 0, fldoff(lndstr, lnd_maxlight), "maxlight"},
{NSC_TIME, 0, 0, fldoff(lndstr, lnd_timestamp), "timestamp"},
{NSC_NOTYPE, 0, 0, 0, NULL}
};
struct castr nuke_ca[] = {
{NSC_UCHAR | NSC_OFF | fldoff(nukstr, nuk_own), "owner", 0},
{NSC_SHORT | NSC_OFF | fldoff(nukstr, nuk_uid), "uid", 0},
{NSC_XCOORD | NSC_OFF | fldoff(nukstr, nuk_x), "xloc", 0},
{NSC_YCOORD | NSC_OFF | fldoff(nukstr, nuk_y), "yloc", 0},
{NSC_CHAR | NSC_OFF | fldoff(nukstr, nuk_n), "number", 0},
{NSC_UCHAR, 0, 0, fldoff(nukstr, nuk_own), "owner"},
{NSC_SHORT, 0, 0, fldoff(nukstr, nuk_uid), "uid"},
{NSC_XCOORD, 0, 0, fldoff(nukstr, nuk_x), "xloc"},
{NSC_YCOORD, 0, 0, fldoff(nukstr, nuk_y), "yloc"},
{NSC_CHAR, 0, 0, fldoff(nukstr, nuk_n), "number"},
#if !defined(_WIN32)
{NSC_CHAR | NSC_OFF | fldoff(nukstr, nuk_types[0]), "types", N_MAXNUKE},
{NSC_CHAR, 0, N_MAXNUKE, fldoff(nukstr, nuk_types[0]), "types"},
#else
{NSC_CHAR | NSC_OFF | fldoff(nukstr, nuk_types), "types", N_MAXNUKE},
{NSC_CHAR, 0, N_MAXNUKE, fldoff(nukstr, nuk_types), "types"},
#endif
{NSC_TIME | NSC_OFF | fldoff(nukstr, nuk_timestamp), "timestamp", 0},
{0, 0, 0}
{NSC_TIME, 0, 0, fldoff(nukstr, nuk_timestamp), "timestamp"},
{NSC_NOTYPE, 0, 0, 0, NULL}
};
struct castr treaty_ca[] = {
{NSC_UCHAR | NSC_OFF | fldoff(trtstr, trt_cna), "cna", 0},
{NSC_UCHAR | NSC_OFF | fldoff(trtstr, trt_cnb), "cnb", 0},
{NSC_UCHAR | NSC_OFF | fldoff(trtstr, trt_status), "status", 0},
{NSC_SHORT | NSC_OFF | fldoff(trtstr, trt_acond), "acond", 0},
{NSC_SHORT | NSC_OFF | fldoff(trtstr, trt_bcond), "bcond", 0},
{NSC_LONG | NSC_OFF | fldoff(trtstr, trt_exp), "exp", 0},
{0, 0, 0}
{NSC_UCHAR, 0, 0, fldoff(trtstr, trt_cna), "cna"},
{NSC_UCHAR, 0, 0, fldoff(trtstr, trt_cnb), "cnb"},
{NSC_UCHAR, 0, 0, fldoff(trtstr, trt_status), "status"},
{NSC_SHORT, 0, 0, fldoff(trtstr, trt_acond), "acond"},
{NSC_SHORT, 0, 0, fldoff(trtstr, trt_bcond), "bcond"},
{NSC_LONG, 0, 0, fldoff(trtstr, trt_exp), "exp"},
{NSC_NOTYPE, 0, 0, 0, NULL}
};
struct castr loan_ca[] = {
{NSC_UCHAR | NSC_OFF | fldoff(lonstr, l_loner), "loaner", 0},
{NSC_SHORT | NSC_OFF | fldoff(lonstr, l_uid), "uid", 0},
{NSC_UCHAR | NSC_OFF | fldoff(lonstr, l_lonee), "loanee", 0},
{NSC_CHAR | NSC_OFF | fldoff(lonstr, l_status), "status", 0},
{NSC_INT | NSC_OFF | fldoff(lonstr, l_irate), "irate", 0},
{NSC_INT | NSC_OFF | fldoff(lonstr, l_ldur), "ldur", 0},
{NSC_LONG | NSC_OFF | fldoff(lonstr, l_amtpaid), "amtpaid", 0},
{NSC_LONG | NSC_OFF | fldoff(lonstr, l_amtdue), "amtdue", 0},
{NSC_TIME | NSC_OFF | fldoff(lonstr, l_lastpay), "lastpay", 0},
{NSC_TIME | NSC_OFF | fldoff(lonstr, l_duedate), "duedate", 0},
{0, 0, 0}
{NSC_UCHAR, 0, 0, fldoff(lonstr, l_loner), "loaner"},
{NSC_SHORT, 0, 0, fldoff(lonstr, l_uid), "uid"},
{NSC_UCHAR, 0, 0, fldoff(lonstr, l_lonee), "loanee"},
{NSC_CHAR, 0, 0, fldoff(lonstr, l_status), "status"},
{NSC_INT, 0, 0, fldoff(lonstr, l_irate), "irate"},
{NSC_INT, 0, 0, fldoff(lonstr, l_ldur), "ldur"},
{NSC_LONG, 0, 0, fldoff(lonstr, l_amtpaid), "amtpaid"},
{NSC_LONG, 0, 0, fldoff(lonstr, l_amtdue), "amtdue"},
{NSC_TIME, 0, 0, fldoff(lonstr, l_lastpay), "lastpay"},
{NSC_TIME, 0, 0, fldoff(lonstr, l_duedate), "duedate"},
{NSC_NOTYPE, 0, 0, 0, NULL}
};
struct castr news_ca[] = {
{NSC_CHAR | NSC_OFF | fldoff(nwsstr, nws_ano), "actor", 0},
{NSC_CHAR | NSC_OFF | fldoff(nwsstr, nws_vrb), "action", 0},
{NSC_CHAR | NSC_OFF | fldoff(nwsstr, nws_vno), "victim", 0},
{NSC_CHAR | NSC_OFF | fldoff(nwsstr, nws_ntm), "times", 0},
{NSC_LONG | NSC_OFF | fldoff(nwsstr, nws_when), "time", 0},
{0, 0, 0}
{NSC_CHAR, 0, 0, fldoff(nwsstr, nws_ano), "actor"},
{NSC_CHAR, 0, 0, fldoff(nwsstr, nws_vrb), "action"},
{NSC_CHAR, 0, 0, fldoff(nwsstr, nws_vno), "victim"},
{NSC_CHAR, 0, 0, fldoff(nwsstr, nws_ntm), "times"},
{NSC_LONG, 0, 0, fldoff(nwsstr, nws_when), "time"},
{NSC_NOTYPE, 0, 0, 0, NULL}
};
struct castr lost_ca[] = {
{NSC_UCHAR | NSC_OFF | fldoff(loststr, lost_owner), "owner", 0},
{NSC_INT | NSC_OFF | fldoff(loststr, lost_uid), "uid", 0},
{NSC_UCHAR | NSC_OFF | fldoff(loststr, lost_type), "type", 0},
{NSC_XCOORD | NSC_OFF | fldoff(loststr, lost_x), "x", 0},
{NSC_YCOORD | NSC_OFF | fldoff(loststr, lost_y), "y", 0},
{NSC_TIME | NSC_OFF | fldoff(loststr, lost_timestamp), "timestamp", 0},
{0, 0, 0}
{NSC_UCHAR, 0, 0, fldoff(loststr, lost_owner), "owner"},
{NSC_INT, 0, 0, fldoff(loststr, lost_uid), "uid"},
{NSC_UCHAR, 0, 0, fldoff(loststr, lost_type), "type"},
{NSC_XCOORD, 0, 0, fldoff(loststr, lost_x), "x"},
{NSC_YCOORD, 0, 0, fldoff(loststr, lost_y), "y"},
{NSC_TIME, 0, 0, fldoff(loststr, lost_timestamp), "timestamp"},
{NSC_NOTYPE, 0, 0, 0, NULL}
};
struct castr commodity_ca[] = {
{NSC_UCHAR | NSC_OFF | fldoff(comstr, com_owner), "owner", 0},
{NSC_SHORT | NSC_OFF | fldoff(comstr, com_uid), "uid", 0},
{NSC_UCHAR | NSC_OFF | fldoff(comstr, com_type), "type", 0},
{NSC_INT | NSC_OFF | fldoff(comstr, com_amount), "amount", 0},
{NSC_INT | NSC_OFF | fldoff(comstr, com_maxbidder), "maxbidder", 0},
{NSC_TIME | NSC_OFF | fldoff(comstr, com_markettime), "markettime", 0},
{NSC_UCHAR, 0, 0, fldoff(comstr, com_owner), "owner"},
{NSC_SHORT, 0, 0, fldoff(comstr, com_uid), "uid"},
{NSC_UCHAR, 0, 0, fldoff(comstr, com_type), "type"},
{NSC_INT, 0, 0, fldoff(comstr, com_amount), "amount"},
{NSC_INT, 0, 0, fldoff(comstr, com_maxbidder), "maxbidder"},
{NSC_TIME, 0, 0, fldoff(comstr, com_markettime), "markettime"},
/* could let maxbidder access these, but we can't express that yet: */
{NSC_DEITY | NSC_INT | NSC_OFF | fldoff(comstr, com_x), "xbuy", 0},
{NSC_DEITY | NSC_INT | NSC_OFF | fldoff(comstr, com_y), "ybuy", 0},
{NSC_INT, NSC_DEITY, 0, fldoff(comstr, com_x), "xbuy"},
{NSC_INT, NSC_DEITY, 0, fldoff(comstr, com_y), "ybuy"},
/* could let the owner access these, but we can't express that yet: */
{NSC_DEITY | NSC_XCOORD | NSC_OFF | fldoff(comstr, sell_x), "xsell", 0},
{NSC_DEITY | NSC_YCOORD | NSC_OFF | fldoff(comstr, sell_y), "ysell", 0},
{NSC_DEITY | NSC_FLOAT | NSC_OFF | fldoff(comstr, com_price), "price", 0},
{0, 0, 0}
{NSC_XCOORD, NSC_DEITY, 0, fldoff(comstr, sell_x), "xsell"},
{NSC_YCOORD, NSC_DEITY, 0, fldoff(comstr, sell_y), "ysell"},
{NSC_FLOAT, NSC_DEITY, 0, fldoff(comstr, com_price), "price"},
{NSC_NOTYPE, 0, 0, 0, NULL}
};
struct castr trade_ca[] = {
{NSC_UCHAR | NSC_OFF | fldoff(trdstr, trd_owner), "owner", 0},
{NSC_SHORT | NSC_OFF | fldoff(trdstr, trd_uid), "uid", 0},
{NSC_UCHAR | NSC_OFF | fldoff(trdstr, trd_type), "type", 0},
{NSC_SHORT | NSC_OFF | fldoff(trdstr, trd_unitid), "unitid", 0},
{NSC_LONG | NSC_OFF | fldoff(trdstr, trd_price), "price", 0},
{NSC_INT | NSC_OFF | fldoff(trdstr, trd_maxbidder), "maxbidder", 0},
{NSC_TIME | NSC_OFF | fldoff(trdstr, trd_markettime), "markettime", 0},
{NSC_UCHAR, 0, 0, fldoff(trdstr, trd_owner), "owner"},
{NSC_SHORT, 0, 0, fldoff(trdstr, trd_uid), "uid"},
{NSC_UCHAR, 0, 0, fldoff(trdstr, trd_type), "type"},
{NSC_SHORT, 0, 0, fldoff(trdstr, trd_unitid), "unitid"},
{NSC_LONG, 0, 0, fldoff(trdstr, trd_price), "price"},
{NSC_INT, 0, 0, fldoff(trdstr, trd_maxbidder), "maxbidder"},
{NSC_TIME, 0, 0, fldoff(trdstr, trd_markettime), "markettime"},
/* could let the owner access these, but we can't express that yet: */
{NSC_DEITY | NSC_XCOORD | NSC_OFF | fldoff(trdstr, trd_x), "xloc", 0},
{NSC_DEITY | NSC_YCOORD | NSC_OFF | fldoff(trdstr, trd_y), "yloc", 0},
{0, 0, 0}
{NSC_XCOORD, NSC_DEITY, 0, fldoff(trdstr, trd_x), "xloc"},
{NSC_YCOORD, NSC_DEITY, 0, fldoff(trdstr, trd_y), "yloc"},
{NSC_NOTYPE, 0, 0, 0, NULL}
};
struct castr nat_ca[] = {
{NSC_UCHAR | NSC_OFF | fldoff(natstr, nat_cnum), "cnum", 0},
{NSC_UCHAR, 0, 0, fldoff(natstr, nat_cnum), "cnum"},
#if !defined(_WIN32)
{NSC_CHAR | NSC_OFF | fldoff(natstr, nat_cnam[0]), "cnam", 20},
{NSC_DEITY | NSC_CHAR | NSC_OFF | fldoff(natstr, nat_pnam[0]), "pnam", 20},
{NSC_CHAR, 0, 20, fldoff(natstr, nat_cnam[0]), "cnam"},
{NSC_CHAR, NSC_DEITY, 20, fldoff(natstr, nat_pnam[0]), "pnam"},
#else
{NSC_CHAR | NSC_OFF | fldoff(natstr, nat_cnam), "cnam", 20},
{NSC_DEITY | NSC_CHAR | NSC_OFF | fldoff(natstr, nat_pnam), "pnam", 20},
{NSC_CHAR, 0, 20, fldoff(natstr, nat_cnam), "cnam"},
{NSC_CHAR, NSC_DEITY, 20, fldoff(natstr, nat_pnam), "pnam"},
#endif
{NSC_XCOORD | NSC_OFF | fldoff(natstr, nat_xstart), "xstart", 0},
{NSC_YCOORD | NSC_OFF | fldoff(natstr, nat_ystart), "ystart", 0},
{NSC_XCOORD | NSC_OFF | fldoff(natstr, nat_xcap), "xcap", 0},
{NSC_YCOORD | NSC_OFF | fldoff(natstr, nat_ycap), "ycap", 0},
{NSC_DEITY | NSC_XCOORD | NSC_OFF | fldoff(natstr, nat_xorg), "xorg", 0},
{NSC_DEITY | NSC_YCOORD | NSC_OFF | fldoff(natstr, nat_yorg), "yorg", 0},
{NSC_XCOORD, 0, 0, fldoff(natstr, nat_xstart), "xstart"},
{NSC_YCOORD, 0, 0, fldoff(natstr, nat_ystart), "ystart"},
{NSC_XCOORD, 0, 0, fldoff(natstr, nat_xcap), "xcap"},
{NSC_YCOORD, 0, 0, fldoff(natstr, nat_ycap), "ycap"},
{NSC_XCOORD, NSC_DEITY, 0, fldoff(natstr, nat_xorg), "xorg"},
{NSC_YCOORD, NSC_DEITY, 0, fldoff(natstr, nat_yorg), "yorg"},
#ifdef MAYBE_LATER
{NSC_CHAR | NSC_OFF | fldoff(natstr, nat_stat), "stat", 0},
{NSC_CHAR | NSC_OFF | fldoff(natstr, nat_dayno), "dayno", 0},
{NSC_CHAR | NSC_OFF | fldoff(natstr, nat_update), "update", 0},
{NSC_UCHAR | NSC_OFF | fldoff(natstr, nat_missed), "missed", 0},
{NSC_CHAR, 0, 0, fldoff(natstr, nat_stat), "stat"},
{NSC_CHAR, 0, 0, fldoff(natstr, nat_dayno), "dayno"},
{NSC_CHAR, 0, 0, fldoff(natstr, nat_update), "update"},
{NSC_UCHAR, 0, 0, fldoff(natstr, nat_missed), "missed"},
#endif /* MAYBE_LATER */
{NSC_USHORT | NSC_OFF | fldoff(natstr, nat_tgms), "tgms", 0},
{NSC_USHORT | NSC_OFF | fldoff(natstr, nat_ann), "ann", 0},
{NSC_USHORT | NSC_OFF | fldoff(natstr, nat_minused), "minused", 0},
{NSC_SHORT | NSC_OFF | fldoff(natstr, nat_btu), "btu", 0},
{NSC_LONG | NSC_OFF | fldoff(natstr, nat_reserve), "reserve", 0},
{NSC_LONG | NSC_OFF | fldoff(natstr, nat_money), "money", 0},
{NSC_USHORT, 0, 0, fldoff(natstr, nat_tgms), "tgms"},
{NSC_USHORT, 0, 0, fldoff(natstr, nat_ann), "ann"},
{NSC_USHORT, 0, 0, fldoff(natstr, nat_minused), "minused"},
{NSC_SHORT, 0, 0, fldoff(natstr, nat_btu), "btu"},
{NSC_LONG, 0, 0, fldoff(natstr, nat_reserve), "reserve"},
{NSC_LONG, 0, 0, fldoff(natstr, nat_money), "money"},
#ifdef MAYBE_LATER
{NSC_LONG | NSC_OFF | fldoff(natstr, nat_last_login), "last_login", 0},
{NSC_LONG | NSC_OFF | fldoff(natstr, nat_last_logout), "last_logout", 0},
{NSC_LONG | NSC_OFF | fldoff(natstr, nat_newstim), "newstim", 0},
{NSC_LONG, 0, 0, fldoff(natstr, nat_last_login), "last_login"},
{NSC_LONG, 0, 0, fldoff(natstr, nat_last_logout), "last_logout"},
{NSC_LONG, 0, 0, fldoff(natstr, nat_newstim), "newstim"},
#endif /* MAYBE_LATER */
#if !defined(_WIN32)
{NSC_FLOAT | NSC_OFF | fldoff(natstr, nat_level[0]), "level", 4},
{NSC_FLOAT, 0, 4, fldoff(natstr, nat_level[0]), "level"},
#else
{NSC_FLOAT | NSC_OFF | fldoff(natstr, nat_level), "level", 4},
{NSC_FLOAT, 0, 4, fldoff(natstr, nat_level), "level"},
#endif
/* {NSC_SHORT | NSC_OFF | fldoff(natstr, nat_relate[0]),"relate",MAXNOC}, */
/* {NSC_CHAR | NSC_OFF | fldoff(natstr, nat_priorities[0]),"priorities",39}, */
/* {NSC_LONG | NSC_OFF | fldoff(natstr, nat_flags),"flags",0}, */
{0, 0, 0}
/* {NSC_SHORT, 0, 0, fldoff(natstr, nat_relate[0]),"relate",MAXNOC}, */
/* {NSC_CHAR, 0, 0, fldoff(natstr, nat_priorities[0]),"priorities",39}, */
/* {NSC_LONG, 0, 0, fldoff(natstr, nat_flags),"flags",0}, */
{NSC_NOTYPE, 0, 0, 0, NULL}
};