]> git.pond.sub.org Git - empserver/blob - include/empobj.h
Update copyright notice
[empserver] / include / empobj.h
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2018, 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  *  empobj.h: General empire objects.
28  *
29  *  Known contributors to this file:
30  *     Ron Koenderink, 2006
31  *     Markus Armbruster, 2006-2014
32  */
33
34 #ifndef EMPOBJ_H
35 #define EMPOBJ_H
36
37 #include "commodity.h"
38 #include "game.h"
39 #include "land.h"
40 #include "loan.h"
41 #include "lost.h"
42 #include "nat.h"
43 #include "nuke.h"
44 #include "plane.h"
45 #include "sect.h"
46 #include "ship.h"
47 #include "trade.h"
48 #include "types.h"
49
50 struct empobj {
51     /*
52      * initial part must match struct emptypedstr
53      * valid if EFF_TYPED is set in table's flags
54      */
55     signed ef_type: 8;
56     unsigned seqno: 12;
57     unsigned generation: 12;
58     int uid;
59     time_t timestamp;
60     /* end of part matching struct emptypedstr */
61     natid own;          /* valid if EFF_OWNER is in table's flags */
62     coord x;            /* valid if EFF_XY    is in table's flags */
63     coord y;            /* valid if EFF_XY    is in table's flags */
64     /* remaining are valid for sectors and units */
65     signed char type;
66     signed char effic;
67     signed char mobil;
68     unsigned char off;
69     /* remaining are valid for units */
70     short tech;
71     char group;         /* valid if EFF_GROUP is in table's flags */
72     coord opx, opy;
73     short mission;
74     short radius;
75 };
76
77 union empobj_storage {
78     struct empobj gen;
79     struct comstr comm;
80     struct gamestr game;
81     struct lndstr land;
82     struct lonstr loan;
83     struct loststr lost;
84     struct natstr nat;
85     struct nukstr nuke;
86     struct plnstr plane;
87     struct realmstr realm;
88     struct sctstr sect;
89     struct shpstr ship;
90     struct trdstr trade;
91 };
92
93 #define get_empobj(type, n, p) ef_read((type), (n), (p))
94 #define put_empobj(type, n, p) ef_write((type), (n), (p))
95 #define get_empobjp(type, n) ((struct empobj *)ef_ptr((type), (n)))
96
97 extern char *empobj_chr_name(struct empobj *gp);
98 extern int empobj_in_use(int, void *);
99
100 #endif