Mercurial > hg > early-roguelike
diff rogue4/options.c @ 229:50b89f165a34
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.
author | John "Elwin" Edwards |
---|---|
date | Sun, 06 Mar 2016 14:45:18 -0500 |
parents | 1b73a8641b37 |
children | e52a8a7ad4c5 |
line wrap: on
line diff
--- a/rogue4/options.c Sat Mar 05 20:49:37 2016 -0500 +++ b/rogue4/options.c Sun Mar 06 14:45:18 2016 -0500 @@ -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 @@ 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 } }; /*