MCPcopy Index your code
hub / github.com/NetHack/NetHack / doset

Function doset

src/options.c:8757–8975  ·  view source on GitHub ↗

the #optionsfull command */

Source from the content-addressed store, hash-verified

8755
8756/* the #optionsfull command */
8757int
8758doset(void) /* changing options via menu by Per Liboriussen */
8759{
8760 static const char fmtstr_tab_doset[] = "%s%s\t[%s]";
8761 char fmtstr_doset[sizeof "%s%-15s [%s] "];
8762 char buf[BUFSZ];
8763 const char *name, *indent;
8764 int i = 0, pass, pick_cnt, pick_idx, opt_indx;
8765 boolean *bool_p;
8766 winid tmpwin;
8767 anything any;
8768 menu_item *pick_list;
8769 int indexoffset, startpass, endpass;
8770 boolean gavehelp = FALSE, skiphelp = !iflags.cmdassist;
8771 int clr = NO_COLOR;
8772
8773 if (iflags.menu_requested) {
8774 /* doset_simple() checks for 'm' and calls doset(); clear the
8775 menu-requested flag to avoid doing that recursively */
8776 iflags.menu_requested = FALSE;
8777 return doset_simple();
8778 }
8779
8780 go.opt_phase = play_opt;
8781 /* if we offer '?' as a choice and it is the only thing chosen,
8782 we'll end up coming back here after showing the explanatory text */
8783 rerun:
8784 tmpwin = create_nhwindow(NHW_MENU);
8785 start_menu(tmpwin, MENU_BEHAVE_STANDARD);
8786
8787 /* offer novices a chance to request helpful [sic] advice */
8788 if (!skiphelp) {
8789 /* help text surrounding '?' choice should have exactly one NULL */
8790 static const char *const helptext[] = {
8791 "For a brief explanation of how this works, type '?' to select",
8792 "the next menu choice, then press <enter> or <return>.",
8793 NULL, /* actual '?' menu entry gets inserted here */
8794 ("[To suppress this menu help,"
8795 " toggle off the 'cmdassist' option.]"),
8796 "",
8797 };
8798 any = cg.zeroany;
8799 for (i = 0; i < SIZE(helptext); ++i) {
8800 if (helptext[i]) {
8801 Sprintf(buf, "%4s%.75s", "", helptext[i]);
8802 add_menu_str(tmpwin, buf);
8803 } else {
8804 any.a_int = HELP_IDX + 1; /* handling pick_list subtracts 1 */
8805 add_menu(tmpwin, &nul_glyphinfo, &any, '?', '?', ATR_NONE,
8806 clr, "view help for options menu",
8807 MENU_ITEMFLAGS_SKIPINVERT);
8808 }
8809 }
8810 }
8811
8812#ifdef notyet /* SYSCF */
8813 /* XXX I think this is still fragile. Fixing initial/from_file and/or
8814 changing the SET_* etc to bitmaps will let me make this better. */

Callers 2

doset_simpleFunction · 0.85
onWMCommandFunction · 0.85

Calls 15

doset_simpleFunction · 0.85
add_menu_strFunction · 0.85
add_menuFunction · 0.85
longest_option_nameFunction · 0.85
add_menu_headingFunction · 0.85
is_wc_optionFunction · 0.85
wc_supportedFunction · 0.85
is_wc2_optionFunction · 0.85
wc2_supportedFunction · 0.85
term_for_booleanFunction · 0.85
enhance_menu_textFunction · 0.85
doset_add_menuFunction · 0.85

Tested by

no test coverage detected