]> git.pond.sub.org Git - empserver/commitdiff
New empfile flag EFF_TYPED to signal struct empobj support
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 24 Feb 2008 09:06:01 +0000 (10:06 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Wed, 5 Mar 2008 21:48:23 +0000 (22:48 +0100)
Elements of tables with EFF_TYPED set share the common header of
struct empobj.

include/file.h
src/lib/global/file.c

index 1242a660f928b5ff2bf045bcc8dd32b043750b18..640adbc9e46351f28923d6c1b5af9d9719feae56 100644 (file)
@@ -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)
index 0a0031a6f10ee17d3244094b82915b963daba893..5e6ec469b13c3eaf2d06899881c227a63d95b931 100644 (file)
@@ -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},