int errors = 0;
int i;
- if (!file) {
- if (!*dflt_econfig) {
- /* No default econfig, use compiled in configuration */
- fixup_files();
- return 0;
- }
+ if (!file)
file = dflt_econfig;
- }
if ((fp = fopen(file, "r")) == NULL) {
fprintf(stderr, "Can't open %s for reading (%s)\n",
file, strerror(errno));
}
}
fclose(fp);
- fixup_files();
WORLD_X &= ~1; /* make even */
return -errors;
}
-struct otherfiles {
- char **files;
- char *name;
-};
-
-/* list of other well known files... -maybe tailor these oneday
- * anyway - meantime they are all relative to datadir */
-static struct otherfiles ofiles[] = {
- {&motdfil, "motd"},
- {&downfil, "down"},
- {&disablefil, "disable"},
- {&banfil, "ban"},
- {&authfil, "auth"},
- {&annfil, "ann"},
- {×tampfil, "timestamp"},
- {&teldir, "tel"},
- {&telfil, "tel/tel"},
- {NULL, NULL}
-};
-
-/* fix up the empfile struct to reference full path names */
-static void
-fixup_files(void)
-{
- struct empfile *ep;
- struct otherfiles *op;
- s_char buf[1024];
-
- for (ep = empfile; ep < &empfile[EF_MAX]; ep++) {
- sprintf(buf, "%s/%s", datadir, ep->name);
- ep->file = strdup(buf);
- }
-
- for (op = ofiles; op->files; op++) {
- sprintf(buf, "%s/%s", datadir, op->name);
- *op->files = strdup(buf);
- }
-}
-
/* find the key in the table */
static struct keymatch *
keylookup(register s_char *command, struct keymatch *tbl)
void
print_config(FILE *fp)
{
- struct empfile *ep;
struct option_list *op;
- struct otherfiles *ofp;
struct keymatch *kp;
fprintf(fp, "# Empire Configuration File:\n");
}
fprintf(fp, "\n");
- for (ep = empfile; ep < &empfile[EF_MAX]; ep++)
- fprintf(fp, "# File %s -> %s\n", ep->name, ep->file);
- for (ofp = ofiles; ofp->files; ofp++)
- fprintf(fp, "# File %s -> %s\n", ofp->name, *(ofp->files));
-
}
#include "commodity.h"
struct empfile empfile[] = {
- {"sect", EMPDIR "/data/sector", EFF_XY | EFF_OWNER,
+ {"sect", "sector", EFF_XY | EFF_OWNER,
0, sizeof(struct sctstr), 0, 0, 0, offsetof(struct sctstr, sct_item),
-1, -1, 0, 0, 0, 0, 0},
- {"ship", EMPDIR "/data/ship", EFF_XY | EFF_OWNER | EFF_GROUP,
+ {"ship", "ship", EFF_XY | EFF_OWNER | EFF_GROUP,
0, sizeof(struct shpstr), 0, 0, 0, offsetof(struct shpstr, shp_item),
-1, -1, 0, 0, 0, 0, 0},
- {"plane", EMPDIR "/data/plane", EFF_XY | EFF_OWNER | EFF_GROUP,
+ {"plane", "plane", EFF_XY | EFF_OWNER | EFF_GROUP,
0, sizeof(struct plnstr), 0, 0, 0, 0,
-1, -1, 0, 0, 0, 0, 0},
- {"land", EMPDIR "/data/land", EFF_XY | EFF_OWNER | EFF_GROUP,
+ {"land", "land", EFF_XY | EFF_OWNER | EFF_GROUP,
0, sizeof(struct lndstr), 0, 0, 0, offsetof(struct lndstr, lnd_item),
-1, -1, 0, 0, 0, 0, 0},
- {"nuke", EMPDIR "/data/nuke", EFF_XY | EFF_OWNER,
+ {"nuke", "nuke", EFF_XY | EFF_OWNER,
0, sizeof(struct nukstr), 0, 0, 0, 0,
-1, -1, 0, 0, 0, 0, 0},
- {"news", EMPDIR "/data/news", 0,
+ {"news", "news", 0,
0, sizeof(struct nwsstr), 0, 0, 0, 0,
-1, -1, 0, 0, 0, 0, 0},
- {"treaty", EMPDIR "/data/treaty", 0,
+ {"treaty", "treaty", 0,
0, sizeof(struct trtstr), 0, 0, 0, 0,
-1, -1, 0, 0, 0, 0, 0},
- {"trade", EMPDIR "/data/trade", 0,
+ {"trade", "trade", 0,
0, sizeof(struct trdstr), 0, 0, 0, 0,
-1, -1, 0, 0, 0, 0, 0},
- {"pow", EMPDIR "/data/power", 0,
+ {"pow", "power", 0,
0, sizeof(struct powstr), 0, 0, 0, 0,
-1, -1, 0, 0, 0, 0, 0},
- {"nat", EMPDIR "/data/nation", 0,
+ {"nat", "nation", 0,
0, sizeof(struct natstr), 0, 0, 0, 0,
-1, -1, 0, 0, 0, 0, 0},
- {"loan", EMPDIR "/data/loan", 0,
+ {"loan", "loan", 0,
0, sizeof(struct lonstr), 0, 0, 0, 0,
-1, -1, 0, 0, 0, 0, 0},
- {"map", EMPDIR "/data/map", 0,
+ {"map", "map", 0,
0, DEF_WORLD_X * DEF_WORLD_Y / 2, 0, 0, 0, 0,
-1, -1, 0, 0, 0, 0, 0},
- {"bmap", EMPDIR "/data/bmap", 0,
+ {"bmap", "bmap", 0,
0, DEF_WORLD_X * DEF_WORLD_Y / 2, 0, 0, 0, 0,
-1, -1, 0, 0, 0, 0, 0},
- {"commodity", EMPDIR "/data/commodity", 0,
+ {"commodity", "commodity", 0,
0, sizeof(struct comstr), 0, 0, 0, 0,
-1, -1, 0, 0, 0, 0, 0},
- {"lost", EMPDIR "/data/lostitems", 0, 0,
+ {"lost", "lostitems", 0, 0,
sizeof(struct loststr), 0, 0, 0, 0,
-1, -1, 0, 0, 0, 0, 0}
};