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
42 #define MAXNOR 50 /* max # realms */
45 short b_xl, b_xh; /* horizontal bounds */
46 short b_yl, b_yh; /* vertical bounds */
51 s_char nat_cnam[20]; /* country name */
52 s_char nat_pnam[20]; /* representative */
53 s_char nat_hostaddr[32]; /* host addr of last user */
54 s_char nat_hostname[512]; /* hostname of last user */
55 s_char nat_userid[32]; /* userid of last user */
56 coord nat_xstart, nat_ystart; /* cap location at start */
57 coord nat_xcap, nat_ycap; /* cap location in abs coords */
58 coord nat_xorg, nat_yorg; /* origin location in abs coords */
59 natid nat_cnum; /* our country number */
60 s_char nat_stat; /* inuse, norm, god, abs */
61 s_char nat_dayno; /* day of the year mod 128 */
62 s_char nat_connected; /* connected or not? */
63 s_char nat_update; /* Want an update or not. */
64 u_char nat_missed; /* How many updates missed */
65 u_short nat_tgms; /* # of telegrams to be announced */
66 u_short nat_ann; /* # of annos pending */
67 u_short nat_minused; /* number of minutes used today */
68 short nat_btu; /* bureaucratic time units */
69 long nat_reserve; /* military reserves */
70 long nat_money; /* moola */
71 time_t nat_last_login; /* time of last login */
72 time_t nat_last_logout; /* time of last logout */
73 time_t nat_newstim; /* date news last read */
74 time_t nat_annotim; /* date annos last read */
75 float nat_level[4]; /* technology, etc */
76 struct boundstr nat_b[MAXNOR]; /* realm bounds */
77 short nat_relate[MAXNOC];
78 short nat_contact[MAXNOC]; /* short for everyone */
79 short nat_rejects[(MAXNOC+3)/4]; /* four bits for each country */
80 s_char nat_priorities[SCT_MAXDEF+8]; /* priority for each SCT_MAXDEF+8*/
81 long nat_flags; /* nation flags */
82 s_char nat_mission_trigger[MI_MAX]; /* not used -- relation to trig */
86 #define PRI_SMAINT SCT_MAXDEF+2
87 #define PRI_PMAINT SCT_MAXDEF+3
88 #define PRI_LMAINT SCT_MAXDEF+4
89 #define PRI_SBUILD SCT_MAXDEF+5
90 #define PRI_PBUILD SCT_MAXDEF+6
91 #define PRI_LBUILD SCT_MAXDEF+7
93 /* nation status types */
94 #define STAT_INUSE bit(0) /* cnum in use */
95 #define STAT_SANCT bit(1) /* country in sanctuary */
96 #define STAT_NORM bit(2) /* normal country */
97 #define STAT_GOD bit(3) /* deity powers */
98 #define STAT_ABS bit(4) /* abs coords */
99 #define STAT_NEW bit(5) /* just initialized */
102 #define WUPD_WANT bit(0)
105 #define VIS STAT_INUSE
106 #define NORM (STAT_INUSE|STAT_NORM)
107 #define GOD (STAT_INUSE|STAT_GOD)
108 #define SANCT (STAT_INUSE|STAT_SANCT)
112 /* nation relation codes */
115 #define MOBILIZATION 2
121 /* nation reject codes */
122 #define REJ_TELE bit(0) /* dont allow telegrams to be sent */
123 #define REJ_TREA bit(1) /* dont allow treaties to be offered */
124 #define REJ_ANNO bit(2) /* don't receive announcements */
125 #define REJ_LOAN bit(3) /* don't allow loans to be offered */
144 #define NF_NATID NF_UCHAR
145 #define NF_COORD NF_SHORT
147 #define FOUND_FLY 3 /* Number of updates contact lasts */
148 #define FOUND_LOOK 5 /* These are only useful with the */
149 #define FOUND_SPY 6 /* LOSE_CONTACT option (and HIDDEN) */
152 #define FOUND_COAST 3
162 /* procedures relating to nation stuff */
165 ef_write(EF_NATION, n->nat_cnum, (caddr_t)n)
167 (struct natstr *) ef_ptr(EF_NATION, (int)n)
169 extern double tfact(natid cn, double mult);
170 extern double tfactfire(natid cn, double mult);
171 extern double techfact(int level, double mult);
172 extern double techfactfire(int level, double mult);
173 extern double reltech(int level1, int level2, double mult);
174 /* src/lib/subs/comsub.c */
175 extern double multread(natid , natid );
176 extern int commread(void );
177 extern int commwrite(void );
178 extern int commlock(void );
179 extern int communlock(void );
180 extern int commamt(natid , int , float * );
181 extern void commset(natid , int , int );
182 extern void multset(natid , float );
183 extern void commprice(int , float * );
185 extern s_char *cname(natid n);
186 extern s_char *relatename(struct natstr *np, natid other);
187 extern s_char *rejectname(struct natstr *np, natid other);
188 extern s_char *natstate(struct natstr *np);
189 extern int getrel(struct natstr *np, natid them);
190 extern int getrejects(natid them, struct natstr *np);
191 extern int getcontact(struct natstr *np, natid them);
192 extern void putrel(struct natstr *np, natid them, int relate);
193 extern void putreject(struct natstr *np, natid them, int how, int what);
194 extern void putcontact(struct natstr *np, natid them, int contact);
195 extern void agecontact(struct natstr *np);
196 extern struct fixnat *natfield();
198 #define NF_INFORM bit(0) /* Inform me of telegrams right away */
199 #define NF_FLASH bit(1) /* Allow other players to flash me (sicko :) */
200 #define NF_BEEP bit(2) /* Make beeping sounds when appropriate */
201 #define NF_COASTWATCH bit(3) /* Turn auto-coastwatch on */
202 #define NF_SONAR bit(4) /* Turn auto-sonar on */
203 #define NF_TECHLISTS bit(5) /* Sort lists by tech not type */
204 #define NF_SACKED bit(6) /* Capital was sacked, and hasn't been reset yet */