]> git.pond.sub.org Git - empserver/blob - src/lib/global/file.c
(rpt, page_headings): Declare with array size. Define without.
[empserver] / src / lib / global / file.c
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2005, Dave Pare, Jeff Bailey, Thomas Ruschak,
4  *                           Ken Stevens, Steve McClure
5  *
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.
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, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  *  ---
21  *
22  *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
23  *  related information and legal notices. It is expected that any future
24  *  projects/authors will amend these files as needed.
25  *
26  *  ---
27  *
28  *  file.c: Empire game data file descriptions.
29  * 
30  *  Known contributors to this file:
31  *     
32  */
33
34 #include <stddef.h>
35 #include "misc.h"
36 #include "xy.h"
37 #include "loan.h"
38 #include "nsc.h"
39 #include "nuke.h"
40 #include "plane.h"
41 #include "ship.h"
42 #include "land.h"
43 #include "sect.h"
44 #include "trade.h"
45 #include "treaty.h"
46 #include "file.h"
47 #include "power.h"
48 #include "news.h"
49 #include "nat.h"
50 #include "lost.h"
51 #include "product.h"
52
53 #include "gamesdef.h"
54 #include "commodity.h"
55 #include "nsc.h"
56
57 struct empfile empfile[] = {
58     /* Dynamic game data */
59     {EF_SECTOR, "sect", "sector", EFF_XY | EFF_OWNER,
60      sizeof(struct sctstr), NULL, NULL, NULL,
61      -1, -1, 0, 0, NULL, 0, sect_ca},
62     {EF_SHIP, "ship", "ship", EFF_XY | EFF_OWNER | EFF_GROUP,
63      sizeof(struct shpstr), NULL, NULL, NULL,
64      -1, -1, 0, 0, NULL, 0, ship_ca},
65     {EF_PLANE, "plane", "plane", EFF_XY | EFF_OWNER | EFF_GROUP,
66      sizeof(struct plnstr), NULL, NULL, NULL,
67      -1, -1, 0, 0, NULL, 0, plane_ca},
68     {EF_LAND, "land", "land", EFF_XY | EFF_OWNER | EFF_GROUP,
69      sizeof(struct lndstr), NULL, NULL, NULL,
70      -1, -1, 0, 0, NULL, 0, land_ca},
71     {EF_NUKE, "nuke", "nuke", EFF_XY | EFF_OWNER,
72      sizeof(struct nukstr), NULL, NULL, NULL,
73      -1, -1, 0, 0, NULL, 0, nuke_ca},
74     {EF_NEWS, "news", "news", 0,
75      sizeof(struct nwsstr), NULL, NULL, NULL,
76      -1, -1, 0, 0, NULL, 0, news_ca},
77     {EF_TREATY, "treaty", "treaty", 0,
78      sizeof(struct trtstr), NULL, NULL, NULL,
79      -1, -1, 0, 0, NULL, 0, treaty_ca},
80     {EF_TRADE, "trade", "trade", 0,
81      sizeof(struct trdstr), NULL, NULL, NULL,
82      -1, -1, 0, 0, NULL, 0, trade_ca},
83     {EF_POWER, "pow", "power", 0,
84      sizeof(struct powstr), NULL, NULL, NULL,
85      -1, -1, 0, 0, NULL, 0, NULL},
86     {EF_NATION, "nat", "nation", EFF_OWNER,
87      sizeof(struct natstr), NULL, NULL, NULL,
88      -1, -1, 0, 0, NULL, 0, nat_ca},
89     {EF_LOAN, "loan", "loan", 0,
90      sizeof(struct lonstr), NULL, NULL, NULL,
91      -1, -1, 0, 0, NULL, 0, loan_ca},
92     {EF_MAP, "map", "map", 0,
93      DEF_WORLD_X * DEF_WORLD_Y / 2, NULL, NULL, NULL,
94      -1, -1, 0, 0, NULL, 0, NULL},
95     {EF_BMAP, "bmap", "bmap", 0,
96      DEF_WORLD_X * DEF_WORLD_Y / 2, NULL, NULL, NULL,
97      -1, -1, 0, 0, NULL, 0, NULL},
98     {EF_COMM, "commodity", "commodity", 0,
99      sizeof(struct comstr), NULL, NULL, NULL,
100      -1, -1, 0, 0, NULL, 0, commodity_ca},
101     {EF_LOST, "lost", "lostitems", EFF_OWNER,
102      sizeof(struct loststr), NULL, NULL, NULL,
103      -1, -1, 0, 0, NULL, 0, lost_ca},
104
105     /* Static game data (configuration) */
106 #define EFF_CFG (EFF_RDONLY | EFF_MEM | EFF_STATIC)
107 #define SZ(array) (sizeof(array) / sizeof((array)[0]))
108 #define CFGTAB(type, name, array, ca) \
109 {(type), (name), NULL, EFF_RDONLY | EFF_MEM | EFF_STATIC, \
110  sizeof((array)[0]), NULL, NULL, NULL, \
111  -1, 0, SZ((array)) - 1, SZ((array)), (char *)(array), SZ((array)) - 1, (ca)}
112     CFGTAB(EF_SECTOR_CHR, "sect chr", dchr, dchr_ca),
113     {EF_SHIP_CHR, "ship chr", NULL, EFF_CFG,
114      sizeof(mchr[0]), NULL, NULL, NULL,
115      -1, -1, 0, 0, (char *)mchr, 0, mchr_ca},
116     {EF_PLANE_CHR, "plane chr", NULL, EFF_CFG,
117      sizeof(plchr[0]), NULL, NULL, NULL,
118      -1, -1, 0, 0, (char *)plchr, 0, plchr_ca},
119     {EF_LAND_CHR, "land chr", NULL, EFF_CFG,
120      sizeof(lchr[0]), NULL, NULL, NULL,
121      -1, -1, 0, 0, (char *)lchr, 0, lchr_ca},
122     {EF_NUKE_CHR, "nuke chr", NULL, EFF_CFG,
123      sizeof(nchr[0]), NULL, NULL, NULL,
124      -1, -1, 0, 0, (char *)nchr, 0, nchr_ca},
125     CFGTAB(EF_NEWS_CHR, "news chr", rpt, rpt_ca),
126     {EF_TREATY_FLAGS, "treaty flags", NULL, EFF_CFG,
127      sizeof(treaty_flags[0]), NULL, NULL, NULL,
128      -1, -1, 0, 0, (char *)treaty_flags, 0, symbol_ca},
129     CFGTAB(EF_ITEM, "item", ichr, ichr_ca),
130     CFGTAB(EF_INFRASTRUCTURE, "infrastructure", intrchr, intrchr_ca),
131     CFGTAB(EF_PRODUCT, "product", pchr, pchr_ca),
132     CFGTAB(EF_TABLE, "table", empfile, empfile_ca),
133     {EF_SHIP_CHR_FLAGS, "ship chr flags", NULL, EFF_CFG,
134      sizeof(ship_chr_flags[0]), NULL, NULL, NULL,
135      -1, -1, 0, 0, (char *)ship_chr_flags, 0, symbol_ca},
136     {EF_PLANE_CHR_FLAGS, "plane chr flags", NULL, EFF_CFG,
137      sizeof(plane_chr_flags[0]), NULL, NULL, NULL,
138      -1, -1, 0, 0, (char *)plane_chr_flags, 0, symbol_ca},
139     {EF_LAND_CHR_FLAGS, "land chr flags", NULL, EFF_CFG,
140      sizeof(land_chr_flags[0]), NULL, NULL, NULL,
141      -1, -1, 0, 0, (char *)land_chr_flags, 0, symbol_ca},
142     {EF_NUKE_CHR_FLAGS, "nuke chr flags", NULL, EFF_CFG,
143      sizeof(nuke_chr_flags[0]), NULL, NULL, NULL,
144      -1, -1, 0, 0, (char *)nuke_chr_flags, 0, symbol_ca},
145     {EF_META, "meta", NULL, EFF_CFG,
146      sizeof(mdchr_ca[0]), NULL, NULL, NULL,
147      -1, -1, 0, 0, (char *)mdchr_ca, 0, mdchr_ca},
148     {EF_META_TYPE, "meta type", NULL, EFF_CFG,
149      sizeof(meta_type[0]), NULL, NULL, NULL,
150      -1, -1, 0, 0, (char *)meta_type, 0, symbol_ca},
151     {EF_META_FLAGS, "meta flags", NULL, EFF_CFG,
152      sizeof(meta_flags[0]), NULL, NULL, NULL,
153      -1, -1, 0, 0, (char *)meta_flags, 0, symbol_ca},
154
155     /* Sentinel */
156     {EF_BAD, NULL, NULL, 0,
157      0, NULL, NULL, NULL,
158      -1, -1, 0,0,NULL, 0, NULL}
159 };