| 5672 | } |
| 5673 | |
| 5674 | staticfn int |
| 5675 | handler_disclose(void) |
| 5676 | { |
| 5677 | winid tmpwin; |
| 5678 | anything any; |
| 5679 | int i, n; |
| 5680 | char buf[BUFSZ]; |
| 5681 | /* order of disclose_names[] must correspond to |
| 5682 | disclosure_options in decl.c */ |
| 5683 | static const char *const disclosure_names[] = { |
| 5684 | "inventory", "attributes", "vanquished", |
| 5685 | "genocides", "conduct", "overview", |
| 5686 | }; |
| 5687 | int disc_cat[NUM_DISCLOSURE_OPTIONS]; |
| 5688 | int pick_cnt, pick_idx, opt_idx; |
| 5689 | char c; |
| 5690 | menu_item *disclosure_pick = (menu_item *) 0; |
| 5691 | int clr = NO_COLOR; |
| 5692 | |
| 5693 | tmpwin = create_nhwindow(NHW_MENU); |
| 5694 | start_menu(tmpwin, MENU_BEHAVE_STANDARD); |
| 5695 | any = cg.zeroany; |
| 5696 | for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++) { |
| 5697 | Sprintf(buf, "%-12s[%c%c]", disclosure_names[i], |
| 5698 | flags.end_disclose[i], disclosure_options[i]); |
| 5699 | any.a_int = i + 1; |
| 5700 | add_menu(tmpwin, &nul_glyphinfo, &any, disclosure_options[i], |
| 5701 | 0, ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE); |
| 5702 | disc_cat[i] = 0; |
| 5703 | } |
| 5704 | end_menu(tmpwin, "Change which disclosure options categories:"); |
| 5705 | pick_cnt = select_menu(tmpwin, PICK_ANY, &disclosure_pick); |
| 5706 | if (pick_cnt > 0) { |
| 5707 | for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx) { |
| 5708 | opt_idx = disclosure_pick[pick_idx].item.a_int - 1; |
| 5709 | disc_cat[opt_idx] = 1; |
| 5710 | } |
| 5711 | free((genericptr_t) disclosure_pick); |
| 5712 | disclosure_pick = (menu_item *) 0; |
| 5713 | } |
| 5714 | destroy_nhwindow(tmpwin); |
| 5715 | |
| 5716 | for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++) { |
| 5717 | if (disc_cat[i]) { |
| 5718 | c = flags.end_disclose[i]; |
| 5719 | Sprintf(buf, "Disclosure options for %s:", |
| 5720 | disclosure_names[i]); |
| 5721 | tmpwin = create_nhwindow(NHW_MENU); |
| 5722 | start_menu(tmpwin, MENU_BEHAVE_STANDARD); |
| 5723 | any = cg.zeroany; |
| 5724 | /* 'y','n',and '+' work as alternate selectors; '-' doesn't */ |
| 5725 | any.a_char = DISCLOSE_NO_WITHOUT_PROMPT; |
| 5726 | add_menu(tmpwin, &nul_glyphinfo, &any, 0, |
| 5727 | any.a_char, ATR_NONE, clr, |
| 5728 | "Never disclose, without prompting", |
| 5729 | (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED |
| 5730 | : MENU_ITEMFLAGS_NONE); |
| 5731 | any.a_char = DISCLOSE_YES_WITHOUT_PROMPT; |
no test coverage detected