The menu for rerolling attributes and inventory. This is similar to the other inventory menus, but simpler to help it fit on the screen (there's more text around it and rerolling is difficult if you can't see the whole list at once). Returns TRUE (and increases numrerolls) if a reroll was requested. */
| 2549 | |
| 2550 | Returns TRUE (and increases numrerolls) if a reroll was requested. */ |
| 2551 | boolean |
| 2552 | reroll_menu(void) |
| 2553 | { |
| 2554 | winid win; |
| 2555 | anything any; |
| 2556 | menu_item *pick_list = NULL; |
| 2557 | struct obj *otmp; |
| 2558 | int tmpglyph; |
| 2559 | glyph_info tmpglyphinfo; |
| 2560 | char option; |
| 2561 | char buf[BUFSZ]; |
| 2562 | |
| 2563 | win = create_nhwindow(NHW_MENU); |
| 2564 | start_menu(win, MENU_BEHAVE_STANDARD); |
| 2565 | any = cg.zeroany; |
| 2566 | |
| 2567 | any.a_char = 'n'; |
| 2568 | add_menu(win, &nul_glyphinfo, &any, flags.lootabc ? 0 : 'p', 0, |
| 2569 | ATR_NONE, NO_COLOR, "start the game with this character", |
| 2570 | MENU_ITEMFLAGS_NONE); |
| 2571 | any.a_char = 'y'; |
| 2572 | add_menu(win, &nul_glyphinfo, &any, flags.lootabc ? 0 : 'r', 0, |
| 2573 | ATR_NONE, NO_COLOR, "reroll another character", |
| 2574 | MENU_ITEMFLAGS_NONE); |
| 2575 | any.a_char = 0; |
| 2576 | add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, NO_COLOR, "", |
| 2577 | MENU_ITEMFLAGS_NONE); |
| 2578 | |
| 2579 | ++gd.distantname; /* avoid adding items to discoveries */ |
| 2580 | ++iflags.override_ID; /* identify them */ |
| 2581 | for (otmp = gi.invent; otmp; otmp = otmp->nobj) { |
| 2582 | tmpglyph = obj_to_glyph(otmp, rn2_on_display_rng); |
| 2583 | map_glyphinfo(0, 0, tmpglyph, 0U, &tmpglyphinfo); |
| 2584 | add_menu(win, &tmpglyphinfo, &any, 0, 0, |
| 2585 | ATR_NONE, NO_COLOR, doname(otmp), MENU_ITEMFLAGS_NONE); |
| 2586 | } |
| 2587 | --iflags.override_ID; |
| 2588 | --gd.distantname; |
| 2589 | |
| 2590 | add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, NO_COLOR, "", |
| 2591 | MENU_ITEMFLAGS_NONE); |
| 2592 | Sprintf(buf, "St:%s Dx:%-1d Co:%-1d In:%-1d Wi:%-1d Ch:%-1d", |
| 2593 | get_strength_str(), |
| 2594 | ACURR(A_DEX), ACURR(A_CON), ACURR(A_INT), ACURR(A_WIS), |
| 2595 | ACURR(A_CHA)); |
| 2596 | add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, NO_COLOR, |
| 2597 | buf, MENU_ITEMFLAGS_NONE); |
| 2598 | |
| 2599 | end_menu(win, "Reroll this character?"); |
| 2600 | if (select_menu(win, PICK_ONE, &pick_list) > 0) { |
| 2601 | option = pick_list[0].item.a_char; |
| 2602 | free((genericptr_t) pick_list); |
| 2603 | } else { |
| 2604 | /* user closed the menu without selecting; unclear what their choice |
| 2605 | is here so ask again; but (e.g. for hangup handling) stop asking if |
| 2606 | the user cancels out again */ |
| 2607 | option = y_n("Reroll this character?"); |
| 2608 | } |
no test coverage detected