]> git.pond.sub.org Git - empserver/blobdiff - include/empobj.h
Record news more compactly
[empserver] / include / empobj.h
index 65b7a6152fcbfb20e8293650e19cfdc6d09f63b2..373ec0212ea745376a556258bee78b6ad0f7f155 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
  *  ---
  *
  *  empobj.h: General empire objects.
- * 
+ *
  *  Known contributors to this file:
  *     Ron Koenderink, 2006
- *     Markus Armbruster, 2006
+ *     Markus Armbruster, 2006-2008
  */
 
 #ifndef EMPOBJ_H
 #define EMPOBJ_H
 
 #include "commodity.h"
+#include "game.h"
 #include "land.h"
 #include "loan.h"
 #include "lost.h"
 #include "types.h"
 
 struct empobj {
-    short ef_type;     /* is always valid */
-    natid own;         /* is valid if EFF_OWNER   is set in table def. */
+    /*
+     * initial part must match struct emptypedstr
+     * valid if EFF_TYPED is set in table's flags
+     */
+    short ef_type;
     short uid;
-    coord x;           /* is valid if EFF_XY      is set in table def. */
-    coord y;           /* is valid if EFF_XY      is set in table def. */
-    signed char type;
+    unsigned seqno;
+    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 */
+    coord y;           /* valid if EFF_XY    is in table's flags */
+    signed char type;  /* valid for sectors and units */
+    /* remaining are valid for units */
     signed char effic;
     signed char mobil;
     unsigned char off;
-    short tech;        
-    char group;                /* is valid if EFF_GROUP   is set in table def. */
+    short tech;
+    char group;                /* valid if EFF_GROUP is in table's flags */
     coord opx, opy;
     short mission;
     short radius;
@@ -70,11 +79,11 @@ union empobj_storage {
     short ef_type;
     struct empobj gen;
     struct comstr comm;
+    struct gamestr game;
     struct lndstr land;
     struct lonstr loan;
     struct loststr lost;
-    struct natstr nat; 
-    struct nwsstr news;
+    struct natstr nat;
     struct nukstr nuke;
     struct plnstr plane;
     struct realmstr realm;
@@ -84,6 +93,15 @@ union empobj_storage {
     struct trtstr treaty;
 };
 
+struct empobj_chr;
+
+#define get_empobj(type, n, p) ef_read((type), (n), (p))
+#define put_empobj(type, n, p) ef_write((type), (n), (p))
+#define get_empobjp(type, n) ((struct empobj *)ef_ptr((type), (n)))
+
 extern char *obj_nameof(struct empobj *gp);
+extern struct empobj_chr *get_empobj_chr(struct empobj *gp);
+extern char *empobj_chr_name(struct empobj *gp);
+extern int get_empobj_mob_max(int type);
 
 #endif