2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2000, 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 */
44 short b_xl, b_xh; /* horizontal bounds */
45 short b_yl, b_yh; /* vertical bounds */
50 s_char nat_cnam[20]; /* country name */
51 s_char nat_pnam[20]; /* representative */
52 s_char nat_hostaddr[32]; /* host addr of last user */
53 s_char nat_hostname[512]; /* hostname of last user */
54 s_char nat_userid[32]; /* userid of last user */
55 coord nat_xstart, nat_ystart; /* cap location at start */
56 coord nat_xcap, nat_ycap; /* cap location in abs coords */
57 coord nat_xorg, nat_yorg; /* origin location in abs coords */
58 natid nat_cnum; /* our country number */
59 s_char nat_stat; /* inuse, norm, god, abs */
60 s_char nat_dayno; /* day of the year mod 128 */
61 s_char nat_connected; /* connected or not? */
62 s_char nat_update; /* Want an update or not. */
63 u_char nat_missed; /* How many updates missed */
64 u_short nat_tgms; /* # of telegrams to be announced */
65 u_short nat_ann; /* # of annos pending */
66 u_short nat_minused; /* number of minutes used today */
67 short nat_btu; /* bureaucratic time units */
68 long nat_reserve; /* military reserves */
69 long nat_money; /* moola */
70 time_t nat_last_login; /* time of last login */
71 time_t nat_last_logout; /* time of last logout */
72 time_t nat_newstim; /* date news last read */
73 time_t nat_annotim; /* date annos last read */
74 float nat_level[4]; /* technology, etc */
75 struct boundstr nat_b[MAXNOR]; /* realm bounds */
76 short nat_relate[MAXNOC];
77 short nat_contact[MAXNOC];
78 short nat_rejects[(MAXNOC + 3) / 4]; /* four bits for each country */
79 s_char nat_priorities[SCT_MAXDEF + 8]; /* priority for each SCT_MAXDEF+8 */
80 long nat_flags; /* nation flags */
85 #define PRI_SMAINT SCT_MAXDEF+2
86 #define PRI_PMAINT SCT_MAXDEF+3
87 #define PRI_LMAINT SCT_MAXDEF+4
88 #define PRI_SBUILD SCT_MAXDEF+5
89 #define PRI_PBUILD SCT_MAXDEF+6
90 #define PRI_LBUILD SCT_MAXDEF+7
92 /* nation status types */
93 #define STAT_INUSE bit(0) /* cnum in use */
94 #define STAT_SANCT bit(1) /* country in sanctuary */
95 #define STAT_NORM bit(2) /* normal country */
96 #define STAT_GOD bit(3) /* deity powers */
97 #define STAT_ABS bit(4) /* abs coords */
98 #define STAT_NEW bit(5) /* just initialized */
101 #define WUPD_WANT bit(0)
104 #define VIS STAT_INUSE
105 #define NORM (STAT_INUSE|STAT_NORM)
106 #define GOD (STAT_INUSE|STAT_GOD)
107 #define SANCT (STAT_INUSE|STAT_SANCT)
111 /* nation relation codes */
114 #define MOBILIZATION 2
120 /* nation reject codes */
121 #define REJ_TELE bit(0) /* dont allow telegrams to be sent */
122 #define REJ_TREA bit(1) /* dont allow treaties to be offered */
123 #define REJ_ANNO bit(2) /* don't receive announcements */
124 #define REJ_LOAN bit(3) /* don't allow loans to be offered */
131 #define FOUND_FLY 3 /* Number of updates contact lasts */
132 #define FOUND_LOOK 5 /* These are only useful with the */
133 #define FOUND_SPY 6 /* LOSE_CONTACT option (and HIDDEN) */
135 #define FOUND_COAST 3
137 extern s_char *relates[];
139 /* procedures relating to nation stuff */
142 ef_write(EF_NATION, n->nat_cnum, (caddr_t)n)
144 (struct natstr *) ef_ptr(EF_NATION, (int)n)
146 extern double tfact(natid cn, double mult);
147 extern double tfactfire(natid cn, double mult);
148 extern double techfact(int level, double mult);
149 extern double techfactfire(int level, double mult);
150 extern double reltech(int level1, int level2, double mult);
151 /* src/lib/subs/comsub.c */
152 extern double multread(natid, natid);
153 extern int commread(void);
154 extern int commwrite(void);
155 extern int commamt(natid, int, float *);
156 extern void commset(natid, int, int);
157 extern void multset(natid, float);
158 extern void commprice(int, float *);
160 extern s_char *cname(natid n);
161 extern s_char *relatename(struct natstr *np, natid other);
162 extern s_char *rejectname(struct natstr *np, natid other);
163 extern s_char *natstate(struct natstr *np);
164 extern int getrel(struct natstr *np, natid them);
165 extern int getrejects(natid them, struct natstr *np);
166 extern int getcontact(struct natstr *np, natid them);
167 extern void putrel(struct natstr *np, natid them, int relate);
168 extern void putreject(struct natstr *np, natid them, int how, int what);
169 extern void putcontact(struct natstr *np, natid them, int contact);
170 extern void agecontact(struct natstr *np);
173 #define NF_INFORM bit(0) /* Inform me of telegrams right away */
174 #define NF_FLASH bit(1) /* Allow other players to flash me (sicko :) */
175 #define NF_BEEP bit(2) /* Make beeping sounds when appropriate */
176 #define NF_COASTWATCH bit(3) /* Turn auto-coastwatch on */
177 #define NF_SONAR bit(4) /* Turn auto-sonar on */
178 #define NF_TECHLISTS bit(5) /* Sort lists by tech not type */
179 #define NF_SACKED bit(6) /* Capital was sacked, and hasn't been reset yet */