New empfile flag EFF_TYPED to signal struct empobj support
Elements of tables with EFF_TYPED set share the common header of struct empobj.
This commit is contained in:
parent
49780e2c6c
commit
d628679a24
2 changed files with 27 additions and 21 deletions
|
@ -71,18 +71,21 @@ struct empfile {
|
|||
* The remaining flags record how the table is being used.
|
||||
*/
|
||||
/* Immutable flags, fixed at compile-time */
|
||||
/* Table entries' addresses can't be safely cast to struct emptyped *. */
|
||||
#define EFF_TYPED bit(0)
|
||||
/*
|
||||
* EFF_XY / EFF_OWNER / EFF_GROUP assert that coordinates / owner /
|
||||
* group of such a table's entries can be safely obtained by
|
||||
* dereferencing entry address cast to struct empobj *.
|
||||
* dereferencing the entry's address cast to struct empobj *.
|
||||
*/
|
||||
#define EFF_XY bit(0)
|
||||
#define EFF_OWNER bit(1)
|
||||
#define EFF_GROUP bit(2)
|
||||
#define EFF_XY bit(1)
|
||||
#define EFF_OWNER bit(2)
|
||||
#define EFF_GROUP bit(3)
|
||||
/* Table is allocated statically */
|
||||
#define EFF_STATIC bit(3)
|
||||
#define EFF_STATIC bit(4)
|
||||
/* All the immutable flags */
|
||||
#define EFF_IMMUTABLE (EFF_XY | EFF_OWNER | EFF_GROUP | EFF_STATIC)
|
||||
#define EFF_IMMUTABLE \
|
||||
(EFF_TYPED | EFF_XY | EFF_OWNER | EFF_GROUP | EFF_STATIC)
|
||||
/* Flags set when table contents is mapped */
|
||||
/* Table is entirely in memory */
|
||||
#define EFF_MEM bit(8)
|
||||
|
|
|
@ -117,39 +117,42 @@ struct empfile empfile[] = {
|
|||
* Fixed up by empfile_fixup().
|
||||
*/
|
||||
{EF_SECTOR, "sect", "sector", sect_ca,
|
||||
UNMAPPED_CACHE(struct sctstr, EFF_XY | EFF_OWNER)},
|
||||
UNMAPPED_CACHE(struct sctstr, EFF_TYPED | EFF_XY | EFF_OWNER)},
|
||||
{EF_SHIP, "ship", "ship", ship_ca,
|
||||
UNMAPPED_CACHE(struct shpstr, EFF_XY | EFF_OWNER | EFF_GROUP)},
|
||||
UNMAPPED_CACHE(struct shpstr,
|
||||
EFF_TYPED | EFF_XY | EFF_OWNER | EFF_GROUP)},
|
||||
{EF_PLANE, "plane", "plane", plane_ca,
|
||||
UNMAPPED_CACHE(struct plnstr, EFF_XY | EFF_OWNER | EFF_GROUP)},
|
||||
UNMAPPED_CACHE(struct plnstr,
|
||||
EFF_TYPED | EFF_XY | EFF_OWNER | EFF_GROUP)},
|
||||
{EF_LAND, "land", "land", land_ca,
|
||||
UNMAPPED_CACHE(struct lndstr, EFF_XY | EFF_OWNER | EFF_GROUP)},
|
||||
UNMAPPED_CACHE(struct lndstr,
|
||||
EFF_TYPED | EFF_XY | EFF_OWNER | EFF_GROUP)},
|
||||
{EF_NUKE, "nuke", "nuke", nuke_ca,
|
||||
UNMAPPED_CACHE(struct nukstr, EFF_XY | EFF_OWNER)},
|
||||
UNMAPPED_CACHE(struct nukstr, EFF_TYPED | EFF_XY | EFF_OWNER)},
|
||||
{EF_NEWS, "news", "news", news_ca,
|
||||
UNMAPPED_CACHE(struct nwsstr, 0)},
|
||||
UNMAPPED_CACHE(struct nwsstr, EFF_TYPED)},
|
||||
{EF_TREATY, "treaty", "treaty", treaty_ca,
|
||||
UNMAPPED_CACHE(struct trtstr, 0)},
|
||||
UNMAPPED_CACHE(struct trtstr, EFF_TYPED)},
|
||||
{EF_TRADE, "trade", "trade", trade_ca,
|
||||
UNMAPPED_CACHE(struct trdstr, EFF_OWNER)},
|
||||
UNMAPPED_CACHE(struct trdstr, EFF_TYPED | EFF_OWNER)},
|
||||
{EF_POWER, "pow", "power", NULL,
|
||||
UNMAPPED_CACHE(struct powstr, 0)},
|
||||
{EF_NATION, "nat", "nation", nat_ca,
|
||||
UNMAPPED_CACHE(struct natstr, EFF_OWNER)},
|
||||
UNMAPPED_CACHE(struct natstr, EFF_TYPED | EFF_OWNER)},
|
||||
{EF_LOAN, "loan", "loan", loan_ca,
|
||||
UNMAPPED_CACHE(struct lonstr, 0)},
|
||||
UNMAPPED_CACHE(struct lonstr, EFF_TYPED)},
|
||||
{EF_MAP, "map", "map", NULL,
|
||||
0, 0, NULL, 0, 0, 0, 0, -1, NULL, NULL, NULL},
|
||||
{EF_BMAP, "bmap", "bmap", NULL,
|
||||
0, 0, NULL, 0, 0, 0, 0, -1, NULL, NULL, NULL},
|
||||
{EF_COMM, "commodity", "commodity", commodity_ca,
|
||||
UNMAPPED_CACHE(struct comstr, EFF_OWNER)},
|
||||
UNMAPPED_CACHE(struct comstr, EFF_TYPED | EFF_OWNER)},
|
||||
{EF_LOST, "lost", "lostitems", lost_ca,
|
||||
UNMAPPED_CACHE(struct loststr, EFF_OWNER)},
|
||||
UNMAPPED_CACHE(struct loststr, EFF_TYPED | EFF_OWNER)},
|
||||
{EF_REALM, "realm", "realms", realm_ca,
|
||||
UNMAPPED_CACHE(struct realmstr, EFF_OWNER)},
|
||||
UNMAPPED_CACHE(struct realmstr, EFF_TYPED | EFF_OWNER)},
|
||||
{EF_GAME, "game", "game", game_ca,
|
||||
UNMAPPED_CACHE(struct gamestr, 0)},
|
||||
UNMAPPED_CACHE(struct gamestr, EFF_TYPED)},
|
||||
|
||||
/*
|
||||
* Static game data (configuration)
|
||||
|
@ -215,7 +218,7 @@ struct empfile empfile[] = {
|
|||
|
||||
/* Views */
|
||||
{EF_COUNTRY, "country", NULL, cou_ca,
|
||||
UNMAPPED_CACHE(struct natstr, EFF_OWNER)},
|
||||
UNMAPPED_CACHE(struct natstr, EFF_TYPED | EFF_OWNER)},
|
||||
|
||||
/* Sentinel */
|
||||
{EF_BAD, NULL, NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, -1, NULL, NULL, NULL},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue