]> git.pond.sub.org Git - empserver/blob - include/nuke.h
Update copyright notice
[empserver] / include / nuke.h
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2012, Dave Pare, Jeff Bailey, Thomas Ruschak,
4  *                Ken Stevens, Steve McClure, Markus Armbruster
5  *
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.
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, see <http://www.gnu.org/licenses/>.
18  *
19  *  ---
20  *
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.
24  *
25  *  ---
26  *
27  *  nuke.h: Definitions for things having to do with nukes
28  *
29  *  Known contributors to this file:
30  *     Dave Pare, 1986
31  */
32
33 #ifndef NUKE_H
34 #define NUKE_H
35
36 #include <time.h>
37 #include "types.h"
38
39 #define N_MAXNUKE       20
40 #define MIN_DRNUKE_CONST        0.001
41
42 struct nukstr {
43     /* initial part must match struct empobj */
44     signed ef_type: 8;
45     unsigned nuk_seqno: 12;
46     unsigned nuk_generation: 12;
47     int nuk_uid;                /* unit id (nuke #) */
48     time_t nuk_timestamp;       /* Last time this nuke was touched */
49     natid nuk_own;
50     coord nuk_x, nuk_y;         /* current loc of device */
51     signed char nuk_type;       /* index in nchr[] */
52     signed char nuk_effic;      /* unused, always 100% */
53     signed char nuk_mobil;      /* unused, always 0 */
54     unsigned char nuk_off;      /* repairs stopped? (unused) */
55     short nuk_tech;             /* nuke's tech level */
56     char nuk_stockpile;         /* group membership, unused */
57     coord nuk_opx, nuk_opy;     /* Op sector coords, unused */
58     short nuk_mission;          /* mission code, unused */
59     short nuk_radius;           /* mission radius, unused */
60     /* end of part matching struct empobj */
61     int nuk_plane;              /* uid of transporting plane, or -1 */
62 };
63
64 struct nchrstr {
65     char *n_name;               /* warhead unit name */
66     int n_lcm;                  /* costs to build */
67     int n_hcm;
68     int n_oil;
69     int n_rad;
70     int n_blast;                /* blast radius */
71     int n_dam;                  /* damage at center */
72     int n_cost;
73     int n_tech;                 /* tech needed to build */
74     int n_weight;
75     int n_flags;                /* description of capability */
76     signed char n_type;         /* index in nchr[] */
77 };
78
79 #define N_NEUT  bit(0)          /* Neutron bomb (low damage, high fallout) */
80
81 #define getnuke(n, p) ef_read(EF_NUKE, (n), (p))
82 #define putnuke(n, p) ef_write(EF_NUKE, (n), (p))
83 #define getnukep(n) ((struct nukstr *)ef_ptr(EF_NUKE, (n)))
84
85 /* Work required for building */
86 #define NUK_BLD_WORK(lcm, hcm, oil, rad) \
87   (((lcm) + 2 * (hcm) + (oil) + (rad) + 4) / 5)
88
89 extern struct nchrstr nchr[N_MAXNUKE + 1];
90
91 /* src/lib/common/cargo.c */
92 extern void nuk_carrier_change(struct nukstr *, int, int, int);
93 extern int nuk_on_plane(struct plnstr *);
94
95 #endif