(keymatch): Replace member km_func by km_type. Initializers adapted.

(emp_config, print_config): Cope with km_type.
(worldxset, intset, floatset, optstrset, doubleset, longset): Unused,
remove.

(emp_config): Fail if specified file can't be read or contains errors.
Used to succeed always, returning RET_OK.  RET_OK is not appropriate,
since this is not a command.  Return 0 on success, -1 on failure.
Callers ignore failure at the moment.  A missing or unreadable econfig
file used to be silently ignored.  It is still ignored, but no longer
silently.  It is questionable whether ignoring is wise, but that's
left for another day.

(emp_config): Improve diagnostic messages.

(set_option): Move diagnostics to caller.

(emp_config): Ignore leading whitespace in `#' comment lines.

(print_config): Simplify printing of km_comment.

(set_option): New parameter val, so it can set and clear options.
(delete_option): Remove.

(KM_ALLOC): Turn macro into enumeration constant.

(KM_INTERNAL): New.
(xdump, xdver): New version dump.

(keymatch, infodir, datadir, teldir, upfil, downfil, disablefil,
telfil, annfil, banfil, timestampfil, privname, privlog, update_times,
update_demandtimes, game_days, game_hours): Use plain char * instead
of s_char * for strings, void * for generic pointers.
This commit is contained in:
Markus Armbruster 2004-09-04 08:07:51 +00:00
parent 4798d1466b
commit d89c268b8b
6 changed files with 282 additions and 319 deletions

View file

@ -99,24 +99,27 @@ int start_unit_type[];
#endif
/* Variables that get values derived from econfig */
extern s_char *upfil;
extern s_char *downfil;
extern s_char *disablefil;
extern s_char *banfil;
extern s_char *authfil;
extern s_char *annfil;
extern s_char *timestampfil;
extern s_char *teldir;
extern s_char *telfil;
extern char *upfil;
extern char *downfil;
extern char *disablefil;
extern char *banfil;
extern char *authfil;
extern char *annfil;
extern char *timestampfil;
extern char *teldir;
extern char *telfil;
enum {
KM_ALLOC = 0x01, /* memory allocated */
KM_INTERNAL = 0x02 /* not to be disclosed to players */
};
struct keymatch {
s_char *km_key; /* the key */
void (*km_func)(struct keymatch * kp, s_char **av);
/* the function to call if matches */
void *km_data; /* associated data */
char *km_key; /* the key */
nsc_type km_type; /* type of associated data */
void *km_data; /* pointer to associated data */
int km_flags; /* useful flags */
#define KM_ALLOC 0x01 /* memory allocated */
s_char *km_comment; /* Comment (hopefully useful) */
char *km_comment; /* Comment (hopefully useful) */
};
extern struct keymatch configkeys[];