]> git.pond.sub.org Git - empserver/commitdiff
Put a timestamp into struct emptypedstr
authorMarkus Armbruster <armbru@pond.sub.org>
Wed, 5 Mar 2008 21:36:48 +0000 (22:36 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 14 Mar 2008 19:25:43 +0000 (20:25 +0100)
Make sure all members of unit empobj_storage share it.

Add matching timestamp member to struct comstr, struct empobj, struct
gamestr, struct lonstr, struct natstr, struct nwsstr, struct trdstr,
struct trtstr.  The timestamp isn't yet set for these.  To be fixed.

Move the timestamp member to the right place in struct lndstr, struct
loststr, struct realmstr, struct nukstr, struct plnstr, struct sctstr,
struct shpstr.

16 files changed:
include/commodity.h
include/empobj.h
include/file.h
include/game.h
include/land.h
include/loan.h
include/lost.h
include/nat.h
include/news.h
include/nuke.h
include/plane.h
include/sect.h
include/ship.h
include/trade.h
include/treaty.h
src/lib/global/nsc.c

index 46a038eb8c96f3b111abb9be244d56954c3cfe46..c375766196d2632b78a83401439f62113892e66c 100644 (file)
@@ -44,6 +44,7 @@ struct comstr {
     /* initial part must match struct empobj */
     short ef_type;
     short com_uid;
+    time_t com_timestamp;
     natid com_owner;
     /* end of part matching struct empobj */
     i_type com_type;
index 57c517eb0532f0a817be128df678f8d9f78153cd..0fbeb0f75d0b6c2e0ebc73c673919a5e1f24e7bb 100644 (file)
@@ -57,6 +57,7 @@ struct empobj {
      */
     short ef_type;
     short uid;
+    time_t timestamp;
     /* end of part matching struct emptypedstr */
     natid own;         /* valid if EFF_OWNER is in table's flags */
     coord x;           /* valid if EFF_XY    is in table's flags */
index f4d8453e0d0212bb5f3eb69d33ba054e25bba1e3..70ec1e1b9fc901157e3e3b7c0da6fe0dd999fc11 100644 (file)
@@ -67,6 +67,7 @@ struct empfile {
 struct emptypedstr {
     short ef_type;
     short uid;
+    time_t timestamp;
 };
 
 /*
index 5d0d897b6f7b551ee81d0737a6ded7285f6cbeee..a553eaba47503a54946a170fda5492865f916551 100644 (file)
@@ -40,6 +40,7 @@ struct gamestr {
     /* initial part must match struct empobj */
     short ef_type;
     short game_uid;
+    time_t game_timestamp;
     /* end of part matching struct empobj */
     char game_upd_disable;     /* updates disabled? */
     /*
index d74db62119f0cc42e7f77367123d0c14789b5d70..3f8158730ba988daf9094f870fc0080a36f58112 100644 (file)
@@ -50,6 +50,7 @@ struct lndstr {
     /* initial part must match struct empobj */
     short ef_type;
     short lnd_uid;             /* unit id (land unit) */
+    time_t lnd_timestamp;      /* Last time this unit was touched */
     natid lnd_own;             /* owner's country num */
     coord lnd_x;               /* x location in abs coords */
     coord lnd_y;               /* y location in abs coords */
@@ -79,7 +80,6 @@ struct lndstr {
     short lnd_land;            /* pointer to transporting unit */
     unsigned char lnd_nland;
     short lnd_access;          /* Last tick mob was updated (MOB_ACCESS) */
-    time_t lnd_timestamp;      /* Last time this unit was touched */
 };
 
 struct lchrstr {
index f2ec2c082fd8be06ec71a0dc7e388dc278bcbe75..542af6c8399d140b9d812ab4ad42666742fcf576 100644 (file)
@@ -44,6 +44,7 @@ struct lonstr {
     /* initial part must match struct empobj */
     short ef_type;
     short l_uid;
+    time_t l_timestamp;
     /* end of part matching struct empobj */
     natid l_loner;             /* loan shark */
     natid l_lonee;             /* sucker */
index 179c7b9d37702b9e7cc8e133063c345f12c4aa9f..c371f936c2a962fdcab935b477abaa07c38eb880 100644 (file)
@@ -41,13 +41,13 @@ struct loststr {
     /* initial part must match struct empobj */
     short ef_type;
     int lost_uid;
+    time_t lost_timestamp;     /* When it was lost */
     natid lost_owner;          /* Who lost it */
     /* end of part matching struct empobj */
     short lost_type;           /* Type of thing (ship, plane, nuke, land, sector) */
     short lost_id;             /* ID of lost thing */
     coord lost_x;
     coord lost_y;
-    time_t lost_timestamp;     /* When it was lost */
 };
 
 #define getlost(n, p) ef_read(EF_LOST, (n), (p))
index 58421b5b7f4e2d2031e4ed887300487fdec9243d..b2f2bd5f81b8b5df37502cd7c5b9f4f1a314b07f 100644 (file)
@@ -70,18 +70,19 @@ struct realmstr {
     /* initial part must match struct empobj */
     short ef_type;
     short r_uid;               /* realm table index */
+    time_t r_timestamp;                /* Last time this realm was touched */
     natid r_cnum;              /* country number */
     /* end of part matching struct empobj */
     unsigned short r_realm;    /* realm number */
     short r_xl, r_xh;          /* horizontal bounds */
     short r_yl, r_yh;          /* vertical bounds */
-    time_t r_timestamp;        /* Last time this realm was touched */
 };
 
 struct natstr {
     /* initial part must match struct empobj */
     short ef_type;
     short nat_uid;             /* equals nat_cnum */
+    time_t nat_timestamp;
     natid nat_cnum;            /* our country number */
     /* end of part matching struct empobj */
     enum nat_status nat_stat;
index 3a2a9b4b31c72d58faa4adf10051d4efb1da6e22..c736114444bfedd1d1f33cc4ee53690d7645f10e 100644 (file)
@@ -48,6 +48,7 @@ struct nwsstr {
     /* initial part must match struct empobj */
     short ef_type;
     short nws_uid;
+    time_t nws_timestamp;
     /* end of part matching struct empobj */
     natid nws_ano;             /* "actor" country # */
     unsigned char nws_vrb;     /* action (verb) */
index cc90de9513049a5b37a43c940ff8439990c8a177..2f7fcdaa1ac98fedf4df0b7a0660dc8393ed604e 100644 (file)
@@ -44,6 +44,7 @@ struct nukstr {
     /* initial part must match struct empobj */
     short ef_type;
     short nuk_uid;
+    time_t nuk_timestamp;      /* Last time this nuke was touched */
     natid nuk_own;
     coord nuk_x, nuk_y;                /* current loc of device */
     signed char nuk_type;      /* index in nchr[] */
@@ -59,7 +60,6 @@ struct nukstr {
     short nuk_ship;            /* currently aboard ship (unused) */
     short nuk_plane;           /* currently aboard plane */
     short nuk_land;            /* currently aboard land (unused) */
-    time_t nuk_timestamp;      /* Last time this nuke was touched */
 };
 
 struct nchrstr {
index 6356a1ebd6d2ac375dcc9019a86c26083b72caff..1ead6d5b0efb83fd3ee7cd110a97f7ba29522b89 100644 (file)
@@ -47,6 +47,7 @@ struct plnstr {
     /* initial part must match struct empobj */
     short ef_type;
     short pln_uid;             /* plane unit id */
+    time_t pln_timestamp;      /* Last time this plane was touched */
     natid pln_own;             /* owning country */
     coord pln_x;               /* plane x-y */
     coord pln_y;
@@ -68,7 +69,6 @@ struct plnstr {
     signed char pln_nuketype;  /* type of nuclear armament (if any) */
     signed char pln_flags;     /* State of the plane */
     short pln_access;          /* Last tick mob was updated (MOB_ACCESS) */
-    time_t pln_timestamp;      /* Last time this plane was touched */
     float pln_theta;           /* position in orbital sine wave */
 };
 
index 15aca8b9d44ecba1577317a9391d05696abe0f44..5932170f14b7cf372fb4ccc87adf9f3e89cf20b1 100644 (file)
@@ -45,6 +45,7 @@ struct sctstr {
     /* initial part must match struct empobj */
     short ef_type;
     short sct_uid;             /* equals sctoff(sct_x, sct_y) */
+    time_t sct_timestamp;      /* Last time this sector was written to */
     natid sct_own;             /* owner's country num */
     coord sct_x;               /* x coord of sector */
     coord sct_y;               /* y coord of sector */
@@ -87,7 +88,6 @@ struct sctstr {
     unsigned char sct_road;    /* Road value of a sector */
     unsigned char sct_rail;    /* Rail value of a sector */
     unsigned char sct_defense; /* Defensive value of a sector */
-    time_t sct_timestamp;      /* Last time this sector was written to */
 };
 
 enum d_navigation {
index 0cfab53c97962371b774055e7cabc32393c524ca..0b9ed35ba277307605af85a3b36ebd3224833166 100644 (file)
@@ -64,6 +64,7 @@ struct shpstr {
     /* initial part must match struct empobj */
     short ef_type;
     short shp_uid;             /* unit id (ship #) */
+    time_t shp_timestamp;      /* Last time this ship was touched. */
     natid shp_own;             /* owner's country num */
     coord shp_x;               /* x location in abs coords */
     coord shp_y;               /* y location in abs coords */
@@ -90,7 +91,6 @@ struct shpstr {
     short shp_pstage;          /* plague stage */
     short shp_ptime;           /* how many etus remain in this stage */
     short shp_access;          /* Last tick mob was updated (MOB_ACCESS) */
-    time_t shp_timestamp;      /* Last time this ship was touched. */
     unsigned char shp_mobquota;        /* mobility quota */
     char shp_path[MAXSHPPATH];
     short shp_follow;
index 8db1e6fe9477f61e6a367db304adbee0c77ae4fe..307f990b4a40fa4dc1f0ba8e941f20e006224d1b 100644 (file)
@@ -44,6 +44,7 @@ struct trdstr {
     /* initial part must match struct empobj */
     short ef_type;
     short trd_uid;
+    time_t trd_timestamp;
     natid trd_owner;
     /* end of part matching struct empobj */
     short trd_type;
index a8c5d258b33b613085a4f223983b02cf0476405c..d5efd77e6d0e90c7795017dd988f7c53f2d848ab 100644 (file)
@@ -41,6 +41,7 @@ struct trtstr {
     /* initial part must match struct empobj */
     short ef_type;
     short trt_uid;
+    time_t trt_timestamp;
     /* end of part matching struct empobj */
     natid trt_cna;             /* proposer */
     natid trt_cnb;             /* acceptor */
index 71edc220b120a69744bb280b7aff5420b17ce584..b145ec3676dfd4dddfebe58df8a16cbef9bb4ec8 100644 (file)
@@ -123,6 +123,8 @@ struct castr sect_ca[] = {
     /* uid needs to be NSC_DEITY because it discloses true origin */
     {"uid", fldoff(sct_uid), NSC_SHORT, 0, NULL,
      EF_SECTOR, NSC_DEITY | NSC_EXTRA},
+    {"timestamp", fldoff(sct_timestamp), NSC_TIME, 0, NULL,
+     EF_BAD, NSC_EXTRA},
     {"owner", fldoff(sct_own), NSC_NATID, 0, NULL, EF_NATION, 0},
     {"xloc", fldoff(sct_x), NSC_XCOORD, 0, NULL, EF_BAD, NSC_CONST},
     {"yloc", fldoff(sct_y), NSC_YCOORD, 0, NULL, EF_BAD, NSC_CONST},
@@ -166,8 +168,6 @@ struct castr sect_ca[] = {
     {"road", fldoff(sct_road), NSC_UCHAR, 0, NULL, EF_BAD, 0},
     {"rail", fldoff(sct_rail), NSC_UCHAR, 0, NULL, EF_BAD, 0},
     {"dfense", fldoff(sct_defense), NSC_UCHAR, 0, NULL, EF_BAD, 0},
-    {"timestamp", fldoff(sct_timestamp), NSC_TIME, 0, NULL,
-     EF_BAD, NSC_EXTRA},
     {NULL, 0, NSC_NOTYPE, 0, NULL, EF_BAD, 0}
 #undef CURSTR
 };
@@ -199,6 +199,7 @@ struct castr dchr_ca[] = {
 
 #define NSC_GENITEM(ef_type, ef_chr)                                   \
     {"uid", empobjoff(uid),  NSC_SHORT, 0, NULL, ef_type, 0},          \
+    {"timestamp", empobjoff(timestamp), NSC_TIME, 0, NULL, EF_BAD, NSC_EXTRA}, \
     {"owner", empobjoff(own),  NSC_NATID, 0, NULL, EF_NATION, 0},      \
     {"xloc", empobjoff(x),  NSC_XCOORD, 0, NULL, EF_BAD, 0},           \
     {"yloc", empobjoff(y),  NSC_YCOORD, 0, NULL, EF_BAD, 0},           \
@@ -235,8 +236,6 @@ struct castr ship_ca[] = {
      EF_PLAGUE_STAGES, NSC_DEITY},
     {"ptime", fldoff(shp_ptime), NSC_SHORT, 0, NULL, EF_BAD, NSC_DEITY},
     {"access", fldoff(shp_access), NSC_SHORT, 0, NULL, EF_BAD, 0},
-    {"timestamp", fldoff(shp_timestamp), NSC_TIME, 0, NULL,
-     EF_BAD, NSC_EXTRA},
     {"mquota", fldoff(shp_mobquota), NSC_UCHAR, 0, NULL, EF_BAD, 0},
     {"path", fldoff(shp_path), NSC_STRINGY, MAXSHPPATH, NULL, EF_BAD, 0},
     {"follow", fldoff(shp_follow), NSC_SHORT, 0, NULL, EF_BAD, 0},
@@ -300,8 +299,6 @@ struct castr plane_ca[] = {
     {"flags", fldoff(pln_flags), NSC_CHAR, 0, NULL,
      EF_PLANE_FLAGS, NSC_BITS},
     {"access", fldoff(pln_access), NSC_SHORT, 0, NULL, EF_BAD, 0},
-    {"timestamp", fldoff(pln_timestamp), NSC_TIME, 0, NULL,
-     EF_BAD, NSC_EXTRA},
     {"theta", fldoff(pln_theta), NSC_FLOAT, 0, NULL, EF_BAD, 0},
     {"att", 0, NSC_LONG, 0, nsc_pln_att, EF_BAD, NSC_EXTRA},
     {"def", 0, NSC_LONG, 0, nsc_pln_def, EF_BAD, NSC_EXTRA},
@@ -352,8 +349,6 @@ struct castr land_ca[] = {
     {"land", fldoff(lnd_land), NSC_SHORT, 0, NULL, EF_BAD, 0},
     {"nland", fldoff(lnd_nland), NSC_UCHAR, 0, NULL, EF_BAD, NSC_EXTRA},
     {"access", fldoff(lnd_access), NSC_SHORT, 0, NULL, EF_BAD, 0},
-    {"timestamp", fldoff(lnd_timestamp), NSC_TIME, 0, NULL,
-     EF_BAD, NSC_EXTRA},
     {"att", 0, NSC_DOUBLE, 0, nsc_lnd_att, EF_BAD, NSC_EXTRA},
     {"def", 0, NSC_DOUBLE, 0, nsc_lnd_def, EF_BAD, NSC_EXTRA},
     {"vul", 0, NSC_LONG, 0, nsc_lnd_vul, EF_BAD, NSC_EXTRA},
@@ -411,8 +406,6 @@ struct castr nuke_ca[] = {
 #define CURSTR struct nukstr
     NSC_GENITEM(EF_NUKE, EF_NUKE_CHR),
     {"plane", fldoff(nuk_plane), NSC_SHORT, 0, NULL, EF_BAD, 0},
-    {"timestamp", fldoff(nuk_timestamp), NSC_TIME, 0, NULL,
-     EF_BAD, NSC_EXTRA},
     {NULL, 0, NSC_NOTYPE, 0, NULL, EF_BAD, 0}
 #undef CURSTR
 };
@@ -484,12 +477,13 @@ struct castr news_ca[] = {
 struct castr lost_ca[] = {
 #define CURSTR struct loststr
    /* no need for uid as long as it's not referenced from other tables */
+    {"timestamp", fldoff(lost_timestamp), NSC_TIME, 0, NULL,
+     EF_BAD, 0},
     {"owner", fldoff(lost_owner), NSC_NATID, 0, NULL, EF_NATION, 0},
     {"type", fldoff(lost_type), NSC_CHAR, 0, NULL, EF_TABLE, 0},
     {"id", fldoff(lost_id), NSC_SHORT, 0, NULL, EF_BAD, 0},
     {"x", fldoff(lost_x), NSC_XCOORD, 0, NULL, EF_BAD, 0},
     {"y", fldoff(lost_y), NSC_YCOORD, 0, NULL, EF_BAD, 0},
-    {"timestamp", fldoff(lost_timestamp), NSC_TIME, 0, NULL, EF_BAD, 0},
     {NULL, 0, NSC_NOTYPE, 0, NULL, EF_BAD, 0}
 #undef CURSTR
 };
@@ -595,14 +589,14 @@ struct castr nat_ca[sizeof(cou_ca) / sizeof(*cou_ca)];
 struct castr realm_ca[] = {
 #define CURSTR struct realmstr
     /* uid is encoded in cnum, realm */
+    {"timestamp", fldoff(r_timestamp), NSC_TIME, 0, NULL,
+     EF_BAD, NSC_EXTRA},
     {"cnum", fldoff(r_cnum), NSC_NATID, 0, NULL, EF_NATION, NSC_CONST},
     {"realm", fldoff(r_realm), NSC_USHORT, 0, NULL, EF_BAD, NSC_CONST},
     {"xl", fldoff(r_xl), NSC_SHORT, 0, NULL, EF_BAD, 0},
     {"xh", fldoff(r_xh), NSC_SHORT, 0, NULL, EF_BAD, 0},
     {"yl", fldoff(r_yl), NSC_SHORT, 0, NULL, EF_BAD, 0},
     {"yh", fldoff(r_yh), NSC_SHORT, 0, NULL, EF_BAD, 0},
-    {"timestamp", fldoff(r_timestamp), NSC_TIME, 0, NULL,
-     EF_BAD, NSC_EXTRA},
     {NULL, 0, NSC_NOTYPE, 0, NULL, EF_BAD, 0}
 #undef CURSTR
 };