(dflt_econfig): New.
(emp_config): Use it when argument is NULL. This simplifies callers except pconfig's main(), which now has to suppress reading the default file. Also fix callers to check the return value. Previously, a typo could easily start a grossly misconfigured program, with potentially disastrous results.
This commit is contained in:
parent
12518b82dd
commit
1583d0c6a2
7 changed files with 23 additions and 32 deletions
|
@ -77,7 +77,6 @@ int
|
|||
main(int argc, char *argv[])
|
||||
{
|
||||
s_char buf[255];
|
||||
s_char tbuf[512];
|
||||
s_char *filename;
|
||||
int x, y;
|
||||
struct natstr nat;
|
||||
|
@ -102,12 +101,9 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
/* Try to use the existing data directory */
|
||||
if (config_file == NULL) {
|
||||
sprintf(tbuf, "%s/econfig", datadir);
|
||||
config_file = tbuf;
|
||||
}
|
||||
emp_config(config_file);
|
||||
if (emp_config(config_file) < 0)
|
||||
exit(1);
|
||||
|
||||
empfile[EF_MAP].size = (WORLD_X * WORLD_Y) / 2;
|
||||
empfile[EF_BMAP].size = (WORLD_X * WORLD_Y) / 2;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue