]> 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-2013, 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-2011
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 "treaty.h"
49 #include "types.h"
50
51 struct empobj {
52     /*
53      * initial part must match struct emptypedstr
54      * valid if EFF_TYPED is set in table's flags
55      */
56     signed ef_type: 8;
57     unsigned seqno: 12;
58     unsigned generation: 12;
59     int uid;
60     time_t timestamp;
61     /* end of part matching struct emptypedstr */
62     natid own;          /* valid if EFF_OWNER is in table's flags */
63     coord x;            /* valid if EFF_XY    is in table's flags */
64     coord y;            /* valid if EFF_XY    is in table's flags */
65     /* remaining are valid for sectors and units */
66     signed char type;
67     signed char effic;
68     signed char mobil;
69     unsigned char off;
70     /* remaining are valid for units */
71     short tech;
72     char group;         /* valid if EFF_GROUP is in table's flags */
73     coord opx, opy;
74     short mission;
75     short radius;
76 };
77
78 union empobj_storage {
79     struct empobj gen;
80     struct comstr comm;
81     struct gamestr game;
82     struct lndstr land;
83     struct lonstr loan;
84     struct loststr lost;
85     struct natstr nat;
86     struct nukstr nuke;
87     struct plnstr plane;
88     struct realmstr realm;
89     struct sctstr sect;
90     struct shpstr ship;
91     struct trdstr trade;
92     struct trtstr treaty;
93 };
94
95 struct empobj_chr;
96
97 #define get_empobj(type, n, p) ef_read((type), (n), (p))
98 #define put_empobj(type, n, p) ef_write((type), (n), (p))
99 #define get_empobjp(type, n) ((struct empobj *)ef_ptr((type), (n)))
100
101 extern char *empobj_chr_name(struct empobj *gp);
102 extern int get_empobj_mob_max(int type);
103 extern int empobj_in_use(int, void *);
104
105 #endif