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 files README, COPYING and CREDITS in the root of the source
23 * tree for related information and legal notices. It is expected
24 * that future projects/authors will amend these files as needed.
28 * sect.h: Definitions for things having to do with sectors.
30 * Known contributors to this file:
43 /* initial part must match struct genitem */
45 natid sct_own; /* owner's country num */
46 short sct_elev; /* elevation/depth */
47 coord sct_x; /* x coord of sector */
48 coord sct_y; /* y coord of sector */
49 /* end of part matching struct genitem */
50 unsigned char sct_type; /* sector type */
51 unsigned char sct_effic; /* 0% to 100% */
52 short sct_mobil; /* mobility units */
53 unsigned char sct_loyal; /* updates until civilans "converted" */
54 unsigned char sct_terr; /* territory 0 id # of sector */
55 unsigned char sct_terr1; /* territory 1 id # of sector */
56 unsigned char sct_terr2; /* territory 2 id # of sector */
57 unsigned char sct_terr3; /* territory 3 id # of sector */
58 coord sct_dist_x; /* Dist sector */
60 short sct_avail; /* available workforce for "other things" */
61 short sct_flags; /* temporary flags */
62 short sct_fill; /* gunk */
63 unsigned char sct_work; /* pct of civ actually working */
64 unsigned char sct_coastal; /* is this a coastal sector? */
65 unsigned char sct_newtype; /* for changing designations */
66 unsigned char sct_min; /* ease of mining ore */
67 unsigned char sct_gmin; /* amount of gold ore */
68 unsigned char sct_fertil; /* fertility of soil */
69 unsigned char sct_oil; /* oil content */
70 unsigned char sct_uran; /* uranium ore content */
71 natid sct_oldown; /* old owner of sector (for liberation) */
72 unsigned char sct_updated; /* Has this sect been updated? */
73 unsigned char sct_off; /* Should this sector produce? */
74 short sct_item[I_MAX+1]; /* amount of items stored here */
75 short sct_del[I_MAX+1]; /* delivieries */
76 short sct_dist[I_MAX+1]; /* distribution thresholds */
77 short sct_mines; /* number of mines */
78 short sct_pstage; /* plague stage */
79 short sct_ptime; /* how many etus remain in this stage */
80 unsigned char sct_che; /* number of guerrillas */
81 natid sct_che_target; /* nation targeted by che */
82 unsigned short sct_fallout;
83 time_t sct_access; /* Last time mob was updated (MOB_ACCESS) */
84 unsigned char sct_road; /* Road value of a sector */
85 unsigned char sct_rail; /* Rail value of a sector */
86 unsigned char sct_defense; /* Defensive value of a sector */
87 time_t sct_timestamp; /* Last time this sector was written to */
91 NAV_NONE, /* ships can't navigate */
92 NAVOK, /* ships can always navigate */
93 NAV_02, /* requires 2% effic to navigate */
94 NAV_CANAL, /* requires 2% effic to navigate and M_CANAL capability */
95 NAV_60 /* requires 60% effic to navigate */
100 char d_mnem; /* map symbol */
101 int d_prd; /* product type */
102 int d_peffic; /* process efficiency, in percent */
103 int d_mcst, d_emcst; /* movement cost at 0 and 100% eff */
104 d_navigation d_nav; /* navigation capability */
105 i_packing d_pkg; /* type of packaging in these sects */
106 float d_ostr; /* offensive strength */
107 float d_dstr; /* defensive strength */
108 int d_value; /* resale ("collect") value */
109 int d_cost; /* cost to designate the sect */
110 int d_build; /* cost multiplier for eff */
111 int d_lcms; /* lcm's needed per point of eff */
112 int d_hcms; /* hcm's needed per point of eff */
113 int d_maxpop; /* maximum population */
114 char *d_name; /* full name of sector type */
117 /* sector types (must agree with order in dchr, empglb.c) */
119 #define SCT_WATER 0 /* basics */
127 #define SCT_ARMSF 8 /* industries */
138 #define SCT_FORTR 19 /* military/scientific */
143 #define SCT_HIWAY 24 /* communications */
145 #define SCT_HEADQ 26 /* headquarters */
146 #define SCT_BHEAD 27 /* Bridge head */
147 #define SCT_BSPAN 28 /* Bridge span */
148 #define SCT_BANK 29 /* financial */
149 #define SCT_REFINE 30 /* refinery */
150 #define SCT_ENLIST 31 /* enlistment center */
151 #define SCT_PLAINS 32 /* plains sector */
152 #define SCT_BTOWER 33 /* Bridge tower */
154 #define SCT_EFFIC 34 /* used in update & budget */
155 #define SCT_MAXDEF 34 /* highest sector type in header files */
157 #define getsect(x, y, p) ef_read(EF_SECTOR, sctoff((x), (y)), (p))
158 #define putsect(p) ef_write(EF_SECTOR, sctoff((p)->sct_x, (p)->sct_y), (p))
159 #define getsectp(x, y) (struct sctstr *)ef_ptr(EF_SECTOR, sctoff((x), (y)))
160 #define getsectid(id) (struct sctstr *)ef_ptr(EF_SECTOR, (id))
162 /* things relating to sectors */
163 extern int sctoff(coord x, coord y);
165 extern struct dchrstr dchr[SCT_MAXDEF + 1];
166 extern struct dchrstr bigcity_dchr;
167 #define IS_BIG_CITY(type) (dchr[(type)].d_pkg == UPKG)
169 /* Minimal efficiency of sectors that can be knocked down (bridges) */
170 #define SCT_MINEFF 20
172 /* Work required for building */
173 #define SCT_BLD_WORK(lcm, hcm) ((lcm) + 2 * (hcm))
175 /* Return SP's defense efficiency */
176 #define SCT_DEFENSE(sp) \
177 (intrchr[INT_DEF].in_enable ? (sp)->sct_defense : (sp)->sct_effic)
179 #define FORTEFF 5 /* forts must be 5% efficient to fire. */
190 #define MOVE_IN_PROGRESS bit(0) /* move in progress */
192 /* maximum item amount, must fit into sct_item[], sct_del[], sct_dist[] */
193 #define ITEM_MAX 9999
194 /* maximum number of mines, must fit into struct sctstr member sct_mines */
195 #define MINES_MAX 32767
196 /* maximum number of che, must fit into struct sctstr member sct_che */
198 /* maximum fallout, must fit into struct sctstr member sct_fallout */
199 #define FALLOUT_MAX 9999
200 /* maximum territory, must fit into struct sctstr members sct_terr etc */
203 /* Each cost is per point of efficency */
206 unsigned char in_lcms; /* construction materials */
207 unsigned char in_hcms;
208 unsigned char in_dcost; /* dollars */
209 unsigned char in_mcost; /* mobility */
210 unsigned char in_enable; /* enabled iff non-zero */
213 extern struct sctintrins intrchr[INT_DEF + 2];