2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2020, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure, Markus Armbruster
6 * Empire 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 3 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, see <http://www.gnu.org/licenses/>.
21 * See files README, COPYING and CREDITS in the root of the source
22 * tree for related information and legal notices. It is expected
23 * that future projects/authors will amend these files as needed.
27 * plane.h: Definitions for planes and plane types
29 * Known contributors to this file:
33 * Markus Armbruster, 2004-2016
44 #define PLN_TYPE_MAX 46
45 #define PLANE_MINEFF 10
48 /* initial part must match struct empobj */
50 unsigned pln_seqno: 12;
51 unsigned pln_generation: 12;
52 int pln_uid; /* unit ID (plane #) */
53 time_t pln_timestamp; /* Last time this plane was touched */
54 natid pln_own; /* owning country */
55 coord pln_x; /* plane x-y */
57 signed char pln_type; /* index in plchr[] */
58 signed char pln_effic; /* actually "training" */
59 signed char pln_mobil; /* plane mobility */
60 unsigned char pln_off; /* repairs stopped? */
61 short pln_tech; /* plane's tech level */
62 char pln_wing; /* like fleet */
63 coord pln_opx; /* Op sector coords */
64 coord pln_opy; /* Op sector coords */
65 short pln_mission; /* mission code */
66 short pln_radius; /* mission radius */
67 /* end of part matching struct empobj */
68 unsigned char pln_range; /* total distance, not radius */
69 signed char pln_harden; /* for missiles */
70 int pln_ship; /* UID of carrier, or -1 */
71 int pln_land; /* UID of transporting land unit, or -1 */
72 int pln_flags; /* State of the plane */
73 short pln_access; /* Last tick mob was updated (MOB_ACCESS) */
74 float pln_theta; /* position in orbital sine wave */
77 #define PLN_LAUNCHED bit(0) /* Flying (satellite: in orbit) */
78 #define PLN_SYNCHRONOUS bit(1) /* A satellite in geo-synchronous orbit */
79 #define PLN_AIRBURST bit(2) /* Airburst the nuke we're armed with */
82 char *pl_name; /* full name of type of plane */
83 short pl_mat[I_MAX+1]; /* materials to build 100% */
84 /* only I_LCM, I_HCM, I_MILIT non-zero */
85 int pl_bwork; /* work to build 100% */
86 int pl_tech; /* tech needed to build */
87 int pl_cost; /* how much it costs to build */
88 int pl_acc; /* bombing accuracy (higher the better) */
89 int pl_load; /* bomb load, also for carrying cargo */
90 int pl_att; /* air-air attack/defense strengths */
92 int pl_range; /* how many sectors it can fly */
93 int pl_fuel; /* fuel consumption */
94 int pl_stealth; /* how stealthy is it? */
95 int pl_flags; /* description of capability */
96 signed char pl_type; /* index in plchr[] */
99 #define P_B bit(0) /* bombing factor only for bombing */
100 #define P_T bit(1) /* tactical bombing ability */
101 #define P_F bit(2) /* interceptor/escort */
102 #define P_C bit(3) /* bombing factor for transport only */
103 #define P_V bit(4) /* vtol ability */
104 #define P_M bit(5) /* missile, used only once, can't be intercepted */
105 #define P_L bit(6) /* light plane, lands on carriers */
106 #define P_S bit(7) /* Spy ability */
107 #define P_I bit(8) /* Imaging ability (advanced spying) */
108 #define P_O bit(9) /* Orbital ability (a satellite) */
110 #define P_N bit(11) /* Nuclear RV interceptor (ABM) */
112 #define P_E bit(13) /* extra light */
113 #define P_K bit(14) /* chopper */
114 #define P_A bit(15) /* ASW (Anti-Sub Warfare) */
115 #define P_P bit(16) /* paradropping */
116 #define P_ESC bit(17) /* escort */
117 #define P_MINE bit(18) /* can lay mines */
118 #define P_SWEEP bit(19) /* can sweep mines */
119 #define P_MAR bit(20) /* missile can hit ships */
121 #define PM_R bit(0) /* Recon mission */
122 #define PM_S bit(1) /* Mine-sweeping mission */
124 /* internal to "fly" module -- really shouldn't be here */
127 struct emp_qelem queue; /* list of planes */
128 int load; /* number of bombs or items carried */
129 short pstage; /* plague stage */
130 struct plchrstr *pcp; /* pointer to desc of plane */
131 struct plnstr plane; /* struct plane */
134 #define getplane(n, p) ef_read(EF_PLANE, (n), (p))
135 #define putplane(n, p) ef_write(EF_PLANE, (n), (p))
136 #define getplanep(n) ((struct plnstr *)ef_ptr(EF_PLANE, (n)))
138 extern struct plchrstr plchr[PLN_TYPE_MAX + 2];
142 struct shiplist *next;
145 extern int pl_att(struct plchrstr *, int);
146 extern int pl_def(struct plchrstr *, int);
147 extern int pl_acc(struct plchrstr *, int);
148 extern int pl_range(struct plchrstr *, int);
149 extern int pl_load(struct plchrstr *, int);
150 extern int pln_att(struct plnstr *);
151 extern int pln_def(struct plnstr *);
152 extern int pln_acc(struct plnstr *);
153 extern int pln_range_max(struct plnstr *);
154 extern int pln_load(struct plnstr *);
156 /* src/lib/common/cargo.c */
157 extern void pln_carrier_change(struct plnstr *, int, int, int);
158 extern int pln_first_on_ship(struct shpstr *);
159 extern int pln_first_on_land(struct lndstr *);
160 extern int pln_next_on_unit(int);
162 /* src/lib/subs/aircombat.c */
163 extern int ac_flak_dam(int, int, int);
164 extern void ac_encounter(struct emp_qelem *, struct emp_qelem *, coord,
166 extern int ac_damage_plane(struct plnstr *, natid, int, int, char *);
168 /* src/lib/subs/aswplnsubs.c */
169 extern int on_shiplist(int, struct shiplist *);
170 extern void add_shiplist(int, struct shiplist **);
171 extern void free_shiplist(struct shiplist **);