]> git.pond.sub.org Git - empserver/commitdiff
Document struct equivalence hack and implications of EFF_XY and
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 28 May 2005 08:03:31 +0000 (08:03 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 28 May 2005 08:03:31 +0000 (08:03 +0000)
EFF_GROUP.

include/file.h
include/land.h
include/nuke.h
include/plane.h
include/sect.h
include/ship.h

index b12ffc5a90e9549bd2a5cb414418eb8b32810896..d1ffcf55637273d86e5584a5f9f60bc13c4408c7 100644 (file)
@@ -55,11 +55,19 @@ struct empfile {
     struct castr *cadef;       /* ca defs selection list */
 };
 
+/*
+ * struct empfile flags
+ *
+ * EFF_XY and EFF_GROUP assert that coordinates / group of such a
+ * file's record can be safely obtained by dereferencing its memory
+ * address cast to struct genitem *
+ */
 #define EFF_XY         bit(0)  /* has location */
 #define EFF_MEM                bit(1)  /* stored entirely in-memory */
 #define EFF_OWNER      bit(2)  /* has concept of owner */
 #define EFF_GROUP      bit(3)  /* has concept of group */
 
+/* file types, types 0..EF_MAX-1 are empfile[] indexes */
 #define EF_BAD         -1      /* illegal file type */
 #define EF_SECTOR      0
 #define EF_SHIP                1
index 1ed6f3dc12378418af4bc8e7d38d97f1e81c5ce7..a34b43d83b2289b68f12fc449b4a360d0d054bb0 100644 (file)
@@ -47,6 +47,7 @@
 #define LND_MINMOBCOST  0.200
 
 struct lndstr {
+    /* initial part must match struct genitem */
     short ef_type;
     natid lnd_own;             /* owner's country num */
     short lnd_uid;             /* unit id (land unit) */
@@ -60,6 +61,7 @@ struct lndstr {
     coord lnd_opx, lnd_opy;    /* Op sector coords */
     short lnd_mission;         /* mission code */
     short lnd_radius;          /* mission radius */
+    /* end of part matching struct genitem */
     s_char lnd_flags;          /* unit flags (unused) */
     short lnd_ship;            /* pointer to transporting ship */
     s_char lnd_harden;         /* for missiles */
index 45e56658f4e58fa5f143db9fa805b211a28d88a7..0ac51ea4913f5b368136e40b9ee6b674417719d0 100644 (file)
 #define        N_MAXNUKE       15
 
 struct nukstr {
+    /* initial part must match struct genitem */
     short ef_type;
     natid nuk_own;
     short nuk_uid;
     coord nuk_x;               /* current loc of device */
     coord nuk_y;
+    /* end of part matching struct genitem */
     s_char nuk_n;              /* number of nukes in list */
     short nuk_ship;            /* currently aboard ship (unused) */
     short nuk_trade;           /* index into trade file (unused) */
index 0508bf7339d720152f62a700b7da9abe10a665be..6bebae2b09001ff6cf2c2b9e7ba2db51ce7fc041 100644 (file)
@@ -46,6 +46,7 @@
  * exactly equivalent with shp_x to shp_fleet
  */
 struct plnstr {
+    /* initial part must match struct genitem */
     short ef_type;
     natid pln_own;             /* owning country */
     short pln_uid;             /* plane unit id */
@@ -60,6 +61,7 @@ struct plnstr {
     coord pln_opy;             /* Op sector coords */
     short pln_mission;         /* mission code */
     short pln_radius;          /* mission radius */
+    /* end of part matching struct genitem */
     u_char pln_range;          /* total distance, not radius */
     u_char pln_range_max;      /* max range for this plane */
     short pln_ship;            /* pointer to carrier */
index 94e1c9ae537a0ee057768467f29976c637c9abfe..ca5bd1cffa594b140dfc202c2ea82b57ccff53a0 100644 (file)
 /* The order of the following elements is there to match up with genitem */
 
 struct sctstr {
+    /* initial part must match struct genitem */
     short ef_type;
     natid sct_own;             /* owner's country num */
     short sct_elev;            /* elevation/depth */
     coord sct_x;               /* x coord of sector */
     coord sct_y;               /* y coord of sector */
+    /* end of part matching struct genitem */
     u_char sct_type;           /* sector type */
     u_char sct_effic;          /* 0% to 100% */
     short sct_mobil;           /* mobility units */
index e8f3e29e4c6a10b0afa3c119a561e1cd3f6ad670..32e25064adea691c876ef26454c13d5cb825630c 100644 (file)
@@ -60,6 +60,7 @@
 #define        MAXSHPNAMLEN    24
 
 struct shpstr {
+    /* initial part must match struct genitem */
     short ef_type;
     natid shp_own;             /* owner's country num */
     short shp_uid;             /* unit id (ship #) */
@@ -73,6 +74,7 @@ struct shpstr {
     coord shp_opx, shp_opy;    /* Op sector coords */
     short shp_mission;         /* mission code */
     short shp_radius;          /* mission radius */
+    /* end of part matching struct genitem */
     u_char shp_nplane;         /* number of planes on board */
     u_char shp_nland;          /* number of land units on board */
     short shp_armor;