]> git.pond.sub.org Git - empserver/blobdiff - include/nat.h
WIP empdump, %a
[empserver] / include / nat.h
index 95afa048a885e6b4d3d27c0922329972545208ce..c7cb0173175428dfcd75bbe3841d0fc5d994c4b0 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-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
 #ifndef NAT_H
 #define NAT_H
 
-#include "sect.h"
+#include <time.h>
+#include "types.h"
+
+#define NATID_BAD 255
 
 #define        MAXNOR          50      /* max # realms */
 
@@ -54,17 +57,6 @@ typedef enum {
     STAT_GOD                   /* deity powers */
 } nat_status;
 
-enum {                         /* Priorities */
-    /* sector types are also priorities */
-    PRI_SMAINT = SCT_MAXDEF+1, /* ship maintenance */
-    PRI_PMAINT,                        /* plane maintenance */
-    PRI_LMAINT,                        /* land unit maintenance */
-    PRI_SBUILD,                        /* ship building */
-    PRI_PBUILD,                        /* plane building */
-    PRI_LBUILD,                        /* land building */
-    PRI_MAX = PRI_LBUILD
-};
-
 
 /*
  * TODO
@@ -73,13 +65,12 @@ enum {                              /* Priorities */
  *
  * The only user of r_cnum and r_realm appears to be xdump.
  * If we had working virtual selectors, we could remove r_cnum and r_realm.
- *
  */
 struct realmstr {
-    /* initial part must match struct genitem */
+    /* initial part must match struct empobj */
     short ef_type;
     natid r_cnum;              /* country number */
-    /* end of part matching struct genitem */
+    /* end of part matching struct empobj */
     short r_uid;               /* realm table index */
     unsigned short r_realm;    /* realm number */
     short r_xl, r_xh;          /* horizontal bounds */
@@ -88,10 +79,10 @@ struct realmstr {
 };
 
 struct natstr {
-    /* initial part must match struct genitem */
+    /* initial part must match struct empobj */
     short ef_type;
     natid nat_cnum;            /* our country number */
-    /* end of part matching struct genitem */
+    /* end of part matching struct empobj */
     nat_status nat_stat;
     char nat_cnam[20];         /* country name */
     char nat_pnam[20];         /* representative */
@@ -102,11 +93,11 @@ struct natstr {
     coord nat_xorg, nat_yorg;  /* origin location in abs coords */
     signed char nat_dayno;     /* day of the year mod 128 */
     signed char nat_update;    /* Want an update or not. */
-    unsigned char nat_missed;  /* How many updates missed */
     unsigned short nat_tgms;   /* # of telegrams to be announced */
     unsigned short nat_ann;    /* # of annos pending */
     unsigned short nat_minused;        /* number of minutes used today */
     short nat_btu;             /* bureaucratic time units */
+    short nat_access;          /* The tick when BTUs were last updated */
     long nat_reserve;          /* military reserves */
     long nat_money;            /* moola */
     time_t nat_last_login;     /* time of last login, 0 menas never */
@@ -117,21 +108,9 @@ struct natstr {
     unsigned char nat_relate[MAXNOC];
     unsigned char nat_contact[MAXNOC];
     unsigned char nat_rejects[MAXNOC];
-    signed char nat_priorities[PRI_MAX+1]; /* budget priority */
     long nat_flags;            /* nation flags */
 };
 
-       /* Update fields. */
-#define        WUPD_WANT       bit(0)
-
-       /* nstat values */
-#define VIS            bit(0)
-#define SANCT          (bit(1) | VIS)
-#define NORM           (bit(2) | VIS)
-#define GOD            (bit(3) | NORM | VIS)
-#define        CAP             bit(6)
-#define        MONEY           bit(7)
-
        /* nation relation codes */
 #define        AT_WAR          0
 #define SITZKRIEG       1
@@ -173,7 +152,7 @@ extern char *relates[];
 /* procedures relating to nation stuff */
 
 #define putnat(p) ef_write(EF_NATION, (p)->nat_cnum, (p))
-#define getnatp(n) (struct natstr *)ef_ptr(EF_NATION, (n))
+#define getnatp(n) ((struct natstr *)ef_ptr(EF_NATION, (n)))
 
 #define getrealm(r, n, p) ef_read(EF_REALM, ((r) + ((n) * MAXNOR)), (p))
 #define putrealm(p) ef_write(EF_REALM, (p)->r_uid, (p))
@@ -194,6 +173,8 @@ extern void putcontact(struct natstr *np, natid them, int contact);
 extern void agecontact(struct natstr *np);
 extern int influx(struct natstr *np);
 
+extern int grant_btus(struct natstr *, int );
+
 /* nation flags */
 #define NF_INFORM      bit(0)  /* Inform me of telegrams right away */
 #define NF_FLASH       bit(1)  /* Allow other players to flash me (sicko :) */