Use uniform return types for functions related to options.

Functions for printing options now return void.  Functions for setting
options now return int.  Argument types still vary, though converting
all the option pointers to void* would be possible.
This commit is contained in:
John "Elwin" Edwards 2016-03-06 14:45:18 -05:00
parent 0a354903e0
commit 35bea2ba0d
4 changed files with 87 additions and 84 deletions

View file

@ -27,8 +27,8 @@
struct optstruct {
char *o_name; /* option name */
char *o_prompt; /* prompt for interactive entry */
int *o_opt; /* pointer to thing to set */
int (*o_putfunc)(); /* function to print value */
void *o_opt; /* pointer to thing to set */
void (*o_putfunc)(); /* function to print value */
int (*o_getfunc)(); /* function to get value interactively */
};
@ -43,23 +43,23 @@ int get_str(char *opt, WINDOW *win);
OPTION optlist[] = {
{"terse", "Terse output: ",
(int *) &terse, put_bool, get_bool },
(void *) &terse, put_bool, get_bool },
{"flush", "Flush typeahead during battle: ",
(int *) &fight_flush, put_bool, get_bool },
(void *) &fight_flush, put_bool, get_bool },
{"jump", "Show position only at end of run: ",
(int *) &jump, put_bool, get_bool },
(void *) &jump, put_bool, get_bool },
{"step", "Do inventories one line at a time: ",
(int *) &slow_invent, put_bool, get_bool },
(void *) &slow_invent, put_bool, get_bool },
{"askme", "Ask me about unidentified things: ",
(int *) &askme, put_bool, get_bool },
(void *) &askme, put_bool, get_bool },
{"passgo", "Follow turnings in passageways: ",
(int *) &passgo, put_bool, get_bool },
(void *) &passgo, put_bool, get_bool },
{"name", "Name: ",
(int *) whoami, put_str, get_str },
(void *) whoami, put_str, get_str },
{"fruit", "Fruit: ",
(int *) fruit, put_str, get_str },
(void *) fruit, put_str, get_str },
{"file", "Save file: ",
(int *) file_name, put_str, get_str }
(void *) file_name, put_str, get_str }
};
/*