relations: Create EF_RELAT table of struct relatstr

New struct relatstr is basically empty so far.  The next commit will
move relations state from struct natstr to struct relatstr.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2016-10-31 17:42:34 +01:00
parent 33f7ae79fe
commit de24545963
24 changed files with 309 additions and 197 deletions

View file

@ -73,6 +73,7 @@ empobj_in_use(int type, void *p)
case EF_NATION:
case EF_COUNTRY:
return ((struct natstr *)p)->nat_stat != STAT_UNUSED;
case EF_RELAT:
case EF_CONTACT:
case EF_REJECT:
return empobj_in_use(EF_NATION,

View file

@ -165,6 +165,9 @@ struct empfile empfile[] = {
{EF_NATION, "nat", "nation", "nation", nat_ca, EF_BAD,
UNMAPPED_CACHE(struct natstr, MAXNOC, EFF_TYPED | EFF_OWNER),
nat_oninit, NULL, NULL, NULL},
{EF_RELAT, "relat", NULL, "relat", relat_ca, EF_BAD,
UNMAPPED_CACHE(struct relatstr, MAXNOC, EFF_TYPED),
NULL, NULL, NULL, NULL},
{EF_CONTACT, "contact", NULL, "contact", contact_ca, EF_BAD,
UNMAPPED_CACHE(struct contactstr, MAXNOC, EFF_TYPED),
contact_oninit, NULL, NULL, NULL},

View file

@ -645,6 +645,15 @@ struct castr cou_ca[] = {
struct castr nat_ca[sizeof(cou_ca) / sizeof(*cou_ca)];
/* initialized by nsc_init() */
struct castr relat_ca[] = {
#define CURSTR struct relatstr
{"uid", fldoff(rel_uid), NSC_INT, 0, NULL, EF_RELAT, 0, CA_DUMP},
{"timestamp", fldoff(rel_timestamp), NSC_TIME, 0, NULL,
EF_BAD, 0, CA_DUMP_NONE},
{NULL, 0, NSC_NOTYPE, 0, NULL, EF_BAD, 0, CA_DUMP}
#undef CURSTR
};
struct castr contact_ca[] = {
#define CURSTR struct contactstr
{"uid", fldoff(con_uid), NSC_INT, 0, NULL, EF_CONTACT, 0, CA_DUMP},

View file

@ -109,6 +109,7 @@ ef_open_srv(void)
failed |= !ef_open(EF_COMM, 0);
failed |= !ef_open(EF_LOST, 0);
failed |= !ef_open(EF_REALM, EFF_MEM);
failed |= !ef_open(EF_RELAT, EFF_MEM);
failed |= !ef_open(EF_CONTACT, EFF_MEM);
failed |= !ef_open(EF_REJECT, EFF_MEM);
if (!failed)
@ -139,6 +140,7 @@ ef_close_srv(void)
ef_close(EF_BMAP);
ef_close(EF_LOST);
ef_close(EF_REALM);
ef_close(EF_RELAT);
ef_close(EF_CONTACT);
ef_close(EF_REJECT);
}