2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2004, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure
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.
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, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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.
28 * file.h: Describes Empire files and their contents
30 * Known contributors to this file:
40 s_char *name; /* file name (e.g., "treaty") */
41 s_char *file; /* file path */
42 int flags; /* misc stuff */
43 int mode; /* O_flags */
44 int size; /* size of object */
45 void (*init) (int, s_char *); /* call this when object is created */
46 int (*postread) (int, s_char *); /* specific massage routines for items */
47 int (*prewrite) (int, s_char *);
48 ptrdiff_t itemoffs; /* offset of item[] in struct */
49 int fd; /* file descriptor */
50 int baseid; /* starting item in cache */
51 int cids; /* # ids in cache */
52 int csize; /* size of cache in bytes */
53 char *cache; /* pointer to cache */
54 int fids; /* # of ids in file */
55 struct castr *cadef; /* ca defs selection list */
58 #define EFF_COM bit(0) /* item has commodities attached */
59 #define EFF_XY bit(1) /* has location */
60 #define EFF_MEM bit(2) /* stored entirely in-memory */
61 #define EFF_OWNER bit(3) /* has concept of owner */
62 #define EFF_GROUP bit(4) /* has concept of group */
64 #define EF_BAD -1 /* illegal file type */
82 #define EF_NMAP 222 /* Kinda bogus, but used to describe a newdesmap
83 instead of bmap or map. */
86 void (*init) (int, s_char *);
87 int (*postread) (int, s_char *);
88 int (*prewrite) (int, s_char *);
92 extern struct castr *ef_cadef(int);
93 extern int ef_read(int, int, void *);
94 extern s_char *ef_ptr(int, int);
95 extern s_char *ef_nameof(int);
96 extern time_t ef_mtime(int);
97 extern int ef_open(int, int, int);
98 extern int ef_check(int);
99 extern int ef_close(int);
100 extern int ef_flush(int);
101 extern int ef_write(int, int, void *);
102 extern int ef_extend(int, int);
103 extern int ef_ensure_space(int, int, int);
104 extern void ef_zapcache(int);
105 extern int ef_nelem(int);
106 extern int ef_flags(int);
107 extern u_short *ef_items(int, void *);
108 extern int ef_byname(s_char *);
110 extern int ef_nbread(int type, int id, void *ptr);
111 extern struct empfile empfile[];
113 #endif /* _FILE_H_ */