Symbolic names for table entries in conditionals, closes #928376:

(ef_elt_byname): New.
(nstr_match_val): Use it to generalize to arbitrary table with
uniquely named elements.  Use ca_type to find table, remove parameter
type.  Callers changed.
(nstr_mkselval): Adapt sanity check accordingly.
(NSC_TYPEID): No longer needed, remove, users changed to use
appropriate integer type instead.  This fixes signedness of sector
selectors des and newdes.
(meta_type): Remove entry for NSC_TYPEID.
(nstr_coerce_val): Can't detect typeid - integer mismatch anymore.
Was nice to have; perhaps revive it later.
This commit is contained in:
Markus Armbruster 2006-06-01 18:48:42 +00:00
parent 15635c25ae
commit c432e3107d
9 changed files with 72 additions and 42 deletions

View file

@ -123,7 +123,7 @@ struct castr sect_ca[] = {
{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_TYPEID, 0, 0, fldoff(sctstr, sct_type), "des", EF_SECTOR_CHR},
{NSC_UCHAR, 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},
@ -137,7 +137,7 @@ struct castr sect_ca[] = {
{NSC_SHORT, 0, 0, fldoff(sctstr, sct_avail), "avail", 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_TYPEID, 0, 0, fldoff(sctstr, sct_newtype), "newdes", EF_SECTOR_CHR},
{NSC_UCHAR, 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},
@ -193,7 +193,7 @@ struct castr dchr_ca[] = {
{ NSC_NATID, 0, 0, fldoff(genitem, own), "owner", EF_NATION}, \
{ NSC_XCOORD, 0, 0, fldoff(genitem, x), "xloc", EF_BAD}, \
{ NSC_YCOORD, 0, 0, fldoff(genitem, y), "yloc", EF_BAD}, \
{ NSC_TYPEID, 0, 0, fldoff(genitem, type), "type", ef_chr}, \
{ NSC_CHAR, 0, 0, fldoff(genitem, type), "type", ef_chr}, \
{ NSC_CHAR, 0, 0, fldoff(genitem, effic), "effic", EF_BAD}, \
{ NSC_CHAR , 0, 0, fldoff(genitem, mobil), "mobil", EF_BAD}, \
{ NSC_UCHAR , 0, 0, fldoff(genitem, off), "off", EF_BAD}, \