2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
23 * related information and legal notices. It is expected that any future
24 * projects/authors will amend these files as needed.
28 * nat.h: Definitions for things having to do with nations
30 * Known contributors to this file:
33 * Steve McClure, 1998-2000
41 #define MAXNOR 50 /* max # realms */
46 * Don't change order without checking inequality comparisons and
49 STAT_UNUSED, /* not in use */
50 STAT_NEW, /* just initialized */
51 STAT_VIS, /* visitor */
52 STAT_SANCT, /* still in sanctuary */
53 STAT_ACTIVE, /* active (sanctuary broken) */
54 STAT_GOD /* deity powers */
57 enum { /* Priorities */
58 /* sector types are also priorities */
59 PRI_SMAINT = SCT_MAXDEF+1, /* ship maintenance */
60 PRI_PMAINT, /* plane maintenance */
61 PRI_LMAINT, /* land unit maintenance */
62 PRI_SBUILD, /* ship building */
63 PRI_PBUILD, /* plane building */
64 PRI_LBUILD, /* land building */
69 short b_xl, b_xh; /* horizontal bounds */
70 short b_yl, b_yh; /* vertical bounds */
74 /* initial part must match struct genitem */
76 natid nat_cnum; /* our country number */
77 /* end of part matching struct genitem */
79 char nat_cnam[20]; /* country name */
80 char nat_pnam[20]; /* representative */
81 char nat_hostaddr[32]; /* host addr of last user */
82 char nat_hostname[512]; /* hostname of last user, may be empty */
83 char nat_userid[32]; /* userid of last user, may be empty */
84 coord nat_xcap, nat_ycap; /* cap location in abs coords */
85 coord nat_xorg, nat_yorg; /* origin location in abs coords */
86 s_char nat_dayno; /* day of the year mod 128 */
87 s_char nat_update; /* Want an update or not. */
88 u_char nat_missed; /* How many updates missed */
89 u_short nat_tgms; /* # of telegrams to be announced */
90 u_short nat_ann; /* # of annos pending */
91 u_short nat_minused; /* number of minutes used today */
92 short nat_btu; /* bureaucratic time units */
93 long nat_reserve; /* military reserves */
94 long nat_money; /* moola */
95 time_t nat_last_login; /* time of last login, 0 menas never */
96 time_t nat_last_logout; /* time of last logout, 0 means never */
97 time_t nat_newstim; /* date news last read */
98 time_t nat_annotim; /* date annos last read */
99 float nat_level[4]; /* technology, etc */
100 struct boundstr nat_b[MAXNOR]; /* realm bounds */
101 short nat_relate[MAXNOC];
102 unsigned char nat_contact[MAXNOC];
103 short nat_rejects[(MAXNOC + 3) / 4]; /* four bits for each country */
104 s_char nat_priorities[PRI_MAX+1]; /* budget priority */
105 long nat_flags; /* nation flags */
110 #define WUPD_WANT bit(0)
114 #define SANCT (bit(1) | VIS)
115 #define NORM (bit(2) | VIS)
116 #define GOD (bit(3) | NORM | VIS)
120 /* nation relation codes */
123 #define MOBILIZATION 2
129 /* nation reject codes */
130 #define REJ_TELE bit(0) /* dont allow telegrams to be sent */
131 #define REJ_TREA bit(1) /* dont allow treaties to be offered */
132 #define REJ_ANNO bit(2) /* don't receive announcements */
133 #define REJ_LOAN bit(3) /* don't allow loans to be offered */
141 * Number of updates contact lasts for various ways of making contact.
142 * These are only useful with option LOSE_CONTACT option, which
143 * implies option HIDDEN.
145 /* Planes spotting and being spotted */
149 /* Spies and ground combat */
153 /* Coastwatch and skywatch */
154 #define FOUND_COAST 3
156 extern char *relates[];
158 /* procedures relating to nation stuff */
161 ef_write(EF_NATION, n->nat_cnum, n)
163 (struct natstr *) ef_ptr(EF_NATION, (int)n)
165 extern double tfact(natid cn, double mult);
166 extern double tfactfire(natid cn, double mult);
167 extern double techfact(int level, double mult);
169 extern char *cname(natid n);
170 extern char *relatename(struct natstr *np, natid other);
171 extern char *rejectname(struct natstr *np, natid other);
172 extern char *natstate(struct natstr *np);
173 extern int getrel(struct natstr *np, natid them);
174 extern int getrejects(natid them, struct natstr *np);
175 extern int getcontact(struct natstr *np, natid them);
176 extern void putrel(struct natstr *np, natid them, int relate);
177 extern void putreject(struct natstr *np, natid them, int how, int what);
178 extern void putcontact(struct natstr *np, natid them, int contact);
179 extern void agecontact(struct natstr *np);
180 extern int influx(struct natstr *np);
183 #define NF_INFORM bit(0) /* Inform me of telegrams right away */
184 #define NF_FLASH bit(1) /* Allow other players to flash me (sicko :) */
185 #define NF_BEEP bit(2) /* Make beeping sounds when appropriate */
186 #define NF_COASTWATCH bit(3) /* Turn auto-coastwatch on */
187 #define NF_SONAR bit(4) /* Turn auto-sonar on */
188 #define NF_TECHLISTS bit(5) /* Sort lists by tech not type */
189 #define NF_SACKED bit(6) /* Capital was sacked, and hasn't been reset yet */