Minimize redundancy between (mortal's) xdump nation and xdump country:
(ef_init_srv): Make NSC_DEITY in cou_ca mirror ~NSC_EXTRA in nat_ca, except for cnum, which may not have either flag in either table. (nat_ca): Make selectors stat, cname, passwd, xorg, yorg, relations, contacts and rejects NSC_EXTRA.
This commit is contained in:
parent
a8e2df3ad8
commit
13cd9081da
2 changed files with 30 additions and 20 deletions
|
@ -487,29 +487,30 @@ struct castr trade_ca[] = {
|
||||||
|
|
||||||
struct castr nat_ca[] = {
|
struct castr nat_ca[] = {
|
||||||
/*
|
/*
|
||||||
* Keep selectors cnum, stat, cname, relations and rejects at the
|
* This is the owner's view, i.e. it applies only to the own
|
||||||
* beginning. ef_init_srv() makes their copies in cou_ca[]
|
* nation. The public view cou_ca[], which applies to all
|
||||||
* accessible for mortals.
|
* nations, has the same selectors with different flags: NSC_DEITY
|
||||||
* It should also make tech, research, education and happiness
|
* is set except for cnum (which must come first) and all
|
||||||
* available, but can't express the obfuscation necessary for
|
* NSC_EXTRA selectors, NSC_EXTRA is cleared.
|
||||||
* foreign levels.
|
* cou_ca[] should also make tech, research, education and
|
||||||
|
* 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_NATID, 0, 0, fldoff(natstr, nat_cnum), "cnum", EF_NATION},
|
||||||
{NSC_SITYPE(nat_status), 0, 0, fldoff(natstr, nat_stat), "stat",
|
{NSC_SITYPE(nat_status), NSC_EXTRA, 0, fldoff(natstr, nat_stat),
|
||||||
EF_NATION_STATUS},
|
"stat", EF_NATION_STATUS},
|
||||||
{NSC_STRINGY, 0, 20, fldoff(natstr, nat_cnam), "cname", EF_BAD},
|
{NSC_STRINGY, NSC_EXTRA, 20, fldoff(natstr, nat_cnam), "cname", EF_BAD},
|
||||||
{NSC_HIDDEN, 0, MAXNOC, fldoff(natstr, nat_relate), "relations",
|
{NSC_STRINGY, NSC_DEITY | NSC_EXTRA, 20, fldoff(natstr, nat_pnam),
|
||||||
EF_NATION_RELATIONS},
|
"passwd", EF_BAD},
|
||||||
{NSC_UCHAR, NSC_BITS, MAXNOC, fldoff(natstr, nat_rejects), "rejects",
|
|
||||||
EF_NATION_REJECTS},
|
|
||||||
{NSC_STRINGY, NSC_DEITY, 20, fldoff(natstr, nat_pnam), "passwd", EF_BAD},
|
|
||||||
{NSC_STRINGY, 0, 32, fldoff(natstr, nat_hostaddr), "ip", 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, 512, fldoff(natstr, nat_hostname), "hostname", EF_BAD},
|
||||||
{NSC_STRINGY, 0, 32, fldoff(natstr, nat_userid), "userid", 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_XCOORD, 0, 0, fldoff(natstr, nat_xcap), "xcap", EF_BAD},
|
||||||
{NSC_YCOORD, 0, 0, fldoff(natstr, nat_ycap), "ycap", EF_BAD},
|
{NSC_YCOORD, 0, 0, fldoff(natstr, nat_ycap), "ycap", EF_BAD},
|
||||||
{NSC_XCOORD, NSC_DEITY, 0, fldoff(natstr, nat_xorg), "xorg", EF_BAD},
|
{NSC_XCOORD, NSC_DEITY | NSC_EXTRA, 0, fldoff(natstr, nat_xorg),
|
||||||
{NSC_YCOORD, NSC_DEITY, 0, fldoff(natstr, nat_yorg), "yorg", EF_BAD},
|
"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_dayno), "dayno", EF_BAD},
|
||||||
{NSC_CHAR, 0, 0, fldoff(natstr, nat_update), "update", EF_BAD},
|
{NSC_CHAR, 0, 0, fldoff(natstr, nat_update), "update", EF_BAD},
|
||||||
{NSC_UCHAR, 0, 0, fldoff(natstr, nat_missed), "missed", EF_BAD},
|
{NSC_UCHAR, 0, 0, fldoff(natstr, nat_missed), "missed", EF_BAD},
|
||||||
|
@ -529,9 +530,13 @@ struct castr nat_ca[] = {
|
||||||
EF_BAD},
|
EF_BAD},
|
||||||
{NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_HLEV]), "happiness",
|
{NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_HLEV]), "happiness",
|
||||||
EF_BAD},
|
EF_BAD},
|
||||||
|
{NSC_HIDDEN, NSC_EXTRA, MAXNOC, fldoff(natstr, nat_relate), "relations",
|
||||||
|
EF_NATION_RELATIONS},
|
||||||
/* mortals know there's contact (relations show), but not how strong */
|
/* mortals know there's contact (relations show), but not how strong */
|
||||||
{NSC_UCHAR, NSC_DEITY, MAXNOC, fldoff(natstr, nat_contact), "contacts",
|
{NSC_UCHAR, NSC_DEITY | NSC_EXTRA, MAXNOC, fldoff(natstr, nat_contact),
|
||||||
EF_BAD},
|
"contacts", EF_BAD},
|
||||||
|
{NSC_UCHAR, NSC_EXTRA | NSC_BITS, MAXNOC, fldoff(natstr, nat_rejects),
|
||||||
|
"rejects", EF_NATION_REJECTS},
|
||||||
/* FIXME nat_priorities[] */
|
/* FIXME nat_priorities[] */
|
||||||
{NSC_LONG, NSC_BITS, 0, fldoff(natstr, nat_flags), "flags",
|
{NSC_LONG, NSC_BITS, 0, fldoff(natstr, nat_flags), "flags",
|
||||||
EF_NATION_FLAGS},
|
EF_NATION_FLAGS},
|
||||||
|
|
|
@ -63,7 +63,7 @@ static void ef_fina_view(int);
|
||||||
void
|
void
|
||||||
ef_init_srv(void)
|
ef_init_srv(void)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i, flags;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(fileinit) / sizeof(fileinit[0]); i++) {
|
for (i = 0; i < sizeof(fileinit) / sizeof(fileinit[0]); i++) {
|
||||||
empfile[fileinit[i].ef_type].init = fileinit[i].init;
|
empfile[fileinit[i].ef_type].init = fileinit[i].init;
|
||||||
|
@ -73,7 +73,12 @@ ef_init_srv(void)
|
||||||
|
|
||||||
for (i = 0; nat_ca[i].ca_name; i++) {
|
for (i = 0; nat_ca[i].ca_name; i++) {
|
||||||
cou_ca[i] = nat_ca[i];
|
cou_ca[i] = nat_ca[i];
|
||||||
cou_ca[i].ca_flags |= NSC_CONST | (i < 5 ? 0 : NSC_DEITY);
|
flags = cou_ca[i].ca_flags | NSC_CONST;
|
||||||
|
if (flags & NSC_EXTRA)
|
||||||
|
flags &= ~NSC_EXTRA;
|
||||||
|
else if (i != 0)
|
||||||
|
flags |= NSC_DEITY;
|
||||||
|
cou_ca[i].ca_flags = flags;
|
||||||
}
|
}
|
||||||
cou_ca[i] = nat_ca[i];
|
cou_ca[i] = nat_ca[i];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue