Make server check game state file sizes on startup

Certain tables have a fixed size depending on configuration: EF_SECTOR
has WORLD_SZ() elements, EF_NATION, EF_MAP and EF_BMAP have MAXNOC
elements, and EF_REALM has MAXNOC * MAXNOR elements.  Bad things
happen if the files backing them are shorter.

Pass expected size to ef_open(), and make it fail when the actual size
differs.
This commit is contained in:
Markus Armbruster 2008-05-17 17:00:57 +02:00
parent b37ebbbde3
commit 5750107b65
5 changed files with 30 additions and 21 deletions

View file

@ -181,7 +181,7 @@ extern int ef_read(int, int, void *);
extern void *ef_ptr(int, int);
extern char *ef_nameof(int);
extern time_t ef_mtime(int);
extern int ef_open(int, int);
extern int ef_open(int, int, int);
extern int ef_check(int);
extern int ef_close(int);
extern int ef_flush(int);