/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2005, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
*
* ---
*
- * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- * related information and legal notices. It is expected that any future
- * projects/authors will amend these files as needed.
+ * See files README, COPYING and CREDITS in the root of the source
+ * tree for related information and legal notices. It is expected
+ * that future projects/authors will amend these files as needed.
*
* ---
*
#define MAXNOR 50 /* max # realms */
+/* Nation status */
+typedef enum {
+ /*
+ * Don't change order without checking inequality comparisons and
+ * array initializers!
+ */
+ STAT_UNUSED, /* not in use */
+ STAT_NEW, /* just initialized */
+ STAT_VIS, /* visitor */
+ STAT_SANCT, /* still in sanctuary */
+ STAT_ACTIVE, /* active (sanctuary broken) */
+ STAT_GOD /* deity powers */
+} nat_status;
+
enum { /* Priorities */
/* sector types are also priorities */
PRI_SMAINT = SCT_MAXDEF+1, /* ship maintenance */
PRI_MAX = PRI_LBUILD
};
-struct boundstr {
- short b_xl, b_xh; /* horizontal bounds */
- short b_yl, b_yh; /* vertical bounds */
+
+/*
+ * TODO
+ *
+ * One of (r_cnum, r_realm) and r_uid is redundant, provided MAXNOR is known.
+ *
+ * The only user of b_cnum and b_realm appears to be xdump.
+ * If we had working virtual selectors, we could remove b_cnum and b_realm.
+ *
+ */
+struct realmstr {
+ short ef_type;
+ natid r_cnum; /* country number */
+ short r_uid; /* realm table index */
+ 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 {
short ef_type;
natid nat_cnum; /* our country number */
/* end of part matching struct genitem */
- s_char nat_stat; /* inuse, norm, god, abs */
+ nat_status nat_stat;
char nat_cnam[20]; /* country name */
char nat_pnam[20]; /* representative */
char nat_hostaddr[32]; /* host addr of last user */
time_t nat_newstim; /* date news last read */
time_t nat_annotim; /* date annos last read */
float nat_level[4]; /* technology, etc */
- struct boundstr nat_b[MAXNOR]; /* realm bounds */
short nat_relate[MAXNOC];
unsigned char nat_contact[MAXNOC];
short nat_rejects[(MAXNOC + 3) / 4]; /* four bits for each country */
char nat_spare[15];
};
- /* nation status types */
-#define STAT_INUSE bit(0) /* cnum in use */
-#define STAT_SANCT bit(1) /* country in sanctuary */
-#define STAT_NORM bit(2) /* normal country */
-#define STAT_GOD bit(3) /* deity powers */
-#define STAT_NEW bit(5) /* just initialized */
-
/* Update fields. */
#define WUPD_WANT bit(0)
/* nstat values */
-#define VIS STAT_INUSE
-#define NORM (STAT_INUSE|STAT_NORM)
-#define GOD (STAT_INUSE|STAT_GOD)
-#define SANCT (STAT_INUSE|STAT_SANCT)
+#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)
/* Coastwatch and skywatch */
#define FOUND_COAST 3
-extern s_char *relates[];
+extern char *relates[];
/* procedures relating to nation stuff */
#define getnatp(n) \
(struct natstr *) ef_ptr(EF_NATION, (int)n)
+#define putrealm(p) \
+ ef_write(EF_REALM, (int)(p)->r_uid, p)
+#define getrealm(r, n, p) \
+ ef_read(EF_REALM, (int)(r + (n * MAXNOR)), p)
+
extern double tfact(natid cn, double mult);
extern double tfactfire(natid cn, double mult);
extern double techfact(int level, double mult);
-extern s_char *cname(natid n);
-extern s_char *relatename(struct natstr *np, natid other);
-extern s_char *rejectname(struct natstr *np, natid other);
-extern s_char *natstate(struct natstr *np);
+extern char *cname(natid n);
+extern char *relatename(struct natstr *np, natid other);
+extern char *rejectname(struct natstr *np, natid other);
+extern char *natstate(struct natstr *np);
extern int getrel(struct natstr *np, natid them);
extern int getrejects(natid them, struct natstr *np);
extern int getcontact(struct natstr *np, natid them);