guts of doset_simple(); called repeatedly until no choice is made */
| 8533 | |
| 8534 | /* guts of doset_simple(); called repeatedly until no choice is made */ |
| 8535 | staticfn int |
| 8536 | doset_simple_menu(void) |
| 8537 | { |
| 8538 | /* unlike doset()'s fmtstr, there is no leading %s for indentation */ |
| 8539 | static const char fmtstr_tab_doset_simple[] = "%s\t[%s]"; |
| 8540 | char fmtstr_doset_simple[sizeof "%-15s [%s] "]; |
| 8541 | menu_item *pick_list; |
| 8542 | boolean *bool_p; |
| 8543 | const char *name, *fmtstr; |
| 8544 | char buf[BUFSZ], buf2[BUFSZ], abuf[BUFSZ]; |
| 8545 | winid tmpwin; |
| 8546 | anything any; |
| 8547 | enum OptSection section; |
| 8548 | int i, k, pick_cnt, reslt; |
| 8549 | boolean toggled_help = FALSE; |
| 8550 | |
| 8551 | /* we do this each time we're called instead of once in doset_simple() |
| 8552 | in case 'menu_tab_sep' ever gets included in the simple menu so |
| 8553 | becomes subject to being changed while doset_simple() is running */ |
| 8554 | if (!iflags.menu_tab_sep) |
| 8555 | Sprintf(fmtstr_doset_simple, "%%-%us [%%s]", |
| 8556 | longest_option_name(set_gameview, set_in_game)); |
| 8557 | else |
| 8558 | Strcpy(fmtstr_doset_simple, fmtstr_tab_doset_simple); |
| 8559 | fmtstr = fmtstr_doset_simple; |
| 8560 | |
| 8561 | redo_opt_help: |
| 8562 | tmpwin = create_nhwindow(NHW_MENU); |
| 8563 | start_menu(tmpwin, MENU_BEHAVE_STANDARD); |
| 8564 | |
| 8565 | /* when showing 'help', also describe how to run full doset() */ |
| 8566 | if (gs.simple_options_help) { |
| 8567 | /* we could look up whether #optionsfull has been bound to a key |
| 8568 | and show that, or whether #reqmenu and #options are both still |
| 8569 | bound to keys and show those, but if meta keys are involved |
| 8570 | the player might not know how to type them; keep this simple */ |
| 8571 | Strcpy(buf, "Use command '#optionsfull'" |
| 8572 | " to get the complete options list."); |
| 8573 | add_menu_str(tmpwin, buf); |
| 8574 | } |
| 8575 | any = cg.zeroany; |
| 8576 | any.a_int = -2 + 1; |
| 8577 | add_menu(tmpwin, &nul_glyphinfo, &any, '?', 0, ATR_NONE, NO_COLOR, |
| 8578 | gs.simple_options_help ? "hide help" : "show help", |
| 8579 | MENU_ITEMFLAGS_NONE); |
| 8580 | |
| 8581 | for (section = OptS_General; section < OptS_Advanced; section++) { |
| 8582 | any = cg.zeroany; |
| 8583 | add_menu_str(tmpwin, ""); |
| 8584 | Sprintf(buf, " %-30s ", OptS_type[section]); |
| 8585 | add_menu_heading(tmpwin, buf); |
| 8586 | for (i = 0; (name = allopt[i].name) != 0; i++) { |
| 8587 | if (allopt[i].section != section) |
| 8588 | continue; |
| 8589 | if ((is_wc_option(name) && !wc_supported(name)) |
| 8590 | || (is_wc2_option(name) && !wc2_supported(name))) |
| 8591 | continue; |
| 8592 |
no test coverage detected