]> git.pond.sub.org Git - empserver/blob - include/sect.h
Import of Empire 4.2.12
[empserver] / include / sect.h
1 /*
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
5  *
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.
10  *
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.
15  *
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
19  *
20  *  ---
21  *
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.
25  *
26  *  ---
27  *
28  *  sect.h: Definitions for things having to do with sectors.
29  * 
30  *  Known contributors to this file:
31  *     Dave Pare
32  *     Ken Stevens, 1995
33  *     Steve McClure, 1998
34  */
35
36
37 /*
38  * each "point" of MAXSCTV costs 32k for 128x128.
39  * MAXSCTV = 20 ==> 655k for the commodities alone!
40  *
41  * If you set this to I_MAX*3, you'll never run ou
42  * of slots, which is nice. (You'll eat a lot of
43  * space, tho)
44  */
45
46 #ifndef _SECT_H_
47 #define _SECT_H_
48
49 #define MAXSCTV 42
50
51 /* The order of the following elements is there to match up with genitem */
52
53 struct  sctstr {
54         short   ef_type;
55         natid   sct_own;        /* owner's country num */
56         short   sct_elev;       /* elevation/depth */
57         coord   sct_x;          /* x coord of sector */
58         coord   sct_y;          /* y coord of sector */
59         u_char  sct_type;       /* sector type */
60         u_char  sct_effic;      /* 0% to 100% */
61         short   sct_mobil;      /* mobility units */
62         u_char  sct_loyal;      /* updates until civilans "converted" */
63         u_char  sct_terr;       /* territory 0 id # of sector */
64         u_char  sct_terr1;      /* territory 1 id # of sector */
65         u_char  sct_terr2;      /* territory 2 id # of sector */
66         u_char  sct_terr3;      /* territory 3 id # of sector */
67         coord   sct_dist_x;     /* Dist sector */
68         coord   sct_dist_y;
69         short   sct_avail;      /* available workforce for "other things" */
70         short   sct_flags;      /* temporary flags */
71         short   sct_fill;       /* gunk */
72         u_char  sct_work;       /* pct of civ actually working */
73         u_char  sct_coastal;    /* is this a coastal sector? */
74         u_char  sct_newtype;    /* for changing designations */
75         u_char  sct_min;        /* ease of mining ore */
76         u_char  sct_gmin;       /* amount of gold ore */
77         u_char  sct_fertil;     /* fertility of soil */
78         u_char  sct_oil;        /* oil content */
79         u_char  sct_uran;       /* uranium ore content */
80         natid   sct_oldown;     /* old owner of sector (for liberation) */
81         u_char  sct_updated;    /* Has this sect been updated? */
82         u_char  sct_off;        /* Should this sector produce? */
83         u_char  sct_nv;         /* current number of variables */
84         u_char  sct_vtype[MAXSCTV];
85         u_short sct_vamt[MAXSCTV];
86         time_t  sct_access;     /* Last time mob was updated (MOB_ACCESS) */
87         u_char  sct_road;       /* Road value of a sector */
88         u_char  sct_rail;       /* Rail value of a sector */
89         u_char  sct_defense;    /* Defensive value of a sector */
90         time_t  sct_timestamp;  /* Last time this sector was written to */
91 };
92
93 struct  dchrstr {
94         int     d_mnem;         /* map symbol */
95         int     d_prd;          /* product vtype */
96         int     d_mcst;         /* movement cost */
97         int     d_flg;          /* movement cost */
98         int     d_pkg;          /* type of packaging in these sects */
99         float   d_ostr;         /* offensive strength */
100         float   d_dstr;         /* defensive strength */
101         int     d_value;        /* resale ("collect") value */
102         int     d_cost;         /* cost to designate the sect */
103         int     d_build;        /* cost multiplier for eff */
104         int     d_lcms;         /* lcm's needed per point of eff */
105         int     d_hcms;         /* hcm's needed per point of eff */
106         s_char  *d_name;        /* full name of sector type */
107 };
108
109 #define NPKG    0               /* no special packaging */
110 #define WPKG    1               /* "warehouse" packaging */
111 #define UPKG    2               /* "urban" packaging */
112 #define BPKG    3               /* "bank" packaging */
113
114 /* for d_flg */
115 #define NAVOK   1               /* ships can always navigate */
116 #define NAV_02  2               /* requires 2% effic to navigate */
117 #define NAV_60  3               /* requires 60% effic to navigate */
118
119         /* sector types (must agree with order in dchr, empglb.c) */
120
121 #define SCT_WATER       0       /* basics */
122 #define SCT_MOUNT       1
123 #define SCT_SANCT       2
124 #define SCT_WASTE       3
125 #define SCT_RURAL       4
126 #define SCT_CAPIT       5
127 #define SCT_URAN        6
128 #define SCT_PARK        7
129 #define SCT_ARMSF       8       /* industries */
130 #define SCT_AMMOF       9
131 #define SCT_MINE        10
132 #define SCT_GMINE       11
133 #define SCT_HARBR       12
134 #define SCT_WAREH       13
135 #define SCT_AIRPT       14
136 #define SCT_AGRI        15
137 #define SCT_OIL         16
138 #define SCT_LIGHT       17
139 #define SCT_HEAVY       18
140 #define SCT_FORTR       19      /* military/scientific */
141 #define SCT_TECH        20
142 #define SCT_RSRCH       21
143 #define SCT_NUKE        22
144 #define SCT_LIBR        23
145 #define SCT_HIWAY       24      /* communications */
146 #define SCT_RADAR       25
147 #define SCT_HEADQ       26      /* headquarters */
148 #define SCT_BHEAD       27      /* Bridge head */
149 #define SCT_BSPAN       28      /* Bridge span */
150 #define SCT_BANK        29      /* financial */
151 #define SCT_REFINE      30      /* refinery */
152 #define SCT_ENLIST      31      /* enlistment center */
153 #define SCT_PLAINS      32      /* plains sector */
154 #define SCT_BTOWER      33      /* Bridge tower */
155
156 #define SCT_EFFIC       34      /* used in update & budget */
157 #define SCT_MAXDEF      34      /* highest sector type in header files */
158
159 #define getsect(x, y, p) \
160         ef_read(EF_SECTOR, sctoff((int) x, (int) y), (caddr_t)p)
161 #define putsect(p) \
162         ef_write(EF_SECTOR, sctoff((int) (p)->sct_x, \
163                 (int) (p)->sct_y), (caddr_t)p)
164 #define getsectp(x, y) \
165         (struct sctstr *) ef_ptr(EF_SECTOR, sctoff((int)x, (int)y))
166 #define getsectid(id) \
167         (struct sctstr *) ef_ptr(EF_SECTOR, id)
168
169 /* things relating to sectors */
170 extern int sctoff(coord x, coord y);
171 extern  double landgun();
172
173 extern  int sct_maxno;
174 extern  struct dchrstr dchr[];
175 extern  struct dchrstr bigcity_dchr;
176
177 #define MIN_MOBCOST  0.001 /* lowest cost a sector can have to move into */
178 #define FORTEFF 5       /* forts must be 5% efficient to fire. */
179
180 #define MOB_NONE    0
181 #define MOB_ROAD    1
182 #define MOB_RAIL    2
183
184 #define INT_ROAD    0
185 #define INT_RAIL    1
186 #define INT_DEF     2
187
188 /* Sector flags */
189 #define MOVE_IN_PROGRESS        bit(0)  /* move in progress */
190
191 /* Each cost is per point of efficency */
192 struct  sctintrins {
193     char *in_name;
194     u_char in_lcms;
195     u_char in_hcms;
196     u_char in_dcost;
197     u_char in_mcost;
198 };
199
200 extern struct sctintrins intrchr[];
201
202 #endif /* _SECT_H_ */