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:
parent
b37ebbbde3
commit
5750107b65
5 changed files with 30 additions and 21 deletions
|
@ -131,7 +131,7 @@ main(int argc, char *argv[])
|
|||
for (i = 0; i < EF_MAX; i++) {
|
||||
if (!EF_IS_GAME_STATE(i))
|
||||
continue;
|
||||
if (!ef_open(i, EFF_CREATE)) {
|
||||
if (!ef_open(i, EFF_CREATE, -1)) {
|
||||
perror("ef_open");
|
||||
exit(1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue