start a menu; show role aspects specified so far as a header line */
| 2803 | |
| 2804 | /* start a menu; show role aspects specified so far as a header line */ |
| 2805 | staticfn winid |
| 2806 | plsel_startmenu(int ttyrows, int aspect) |
| 2807 | { |
| 2808 | char qbuf[QBUFSZ]; |
| 2809 | winid win; |
| 2810 | const char *rolename; |
| 2811 | |
| 2812 | /* whatever aspect was just chosen might force others (Orc => chaotic, |
| 2813 | Samurai => Human+lawful, Valkyrie => female) */ |
| 2814 | rigid_role_checks(); |
| 2815 | |
| 2816 | rolename = (ROLE < 0) ? "<role>" |
| 2817 | : (GEND == 1 && roles[ROLE].name.f) ? roles[ROLE].name.f |
| 2818 | : roles[ROLE].name.m; |
| 2819 | if (!svp.plname[0] || ROLE < 0 || RACE < 0 || GEND < 0 || ALGN < 0) { |
| 2820 | /* "<role> <race.noun> <gender> <alignment>" */ |
| 2821 | Sprintf(qbuf, "%.20s %.20s %.20s %.20s", |
| 2822 | rolename, |
| 2823 | (RACE < 0) ? "<race>" : races[RACE].noun, |
| 2824 | (GEND < 0) ? "<gender>" : genders[GEND].adj, |
| 2825 | (ALGN < 0) ? "<alignment>" : aligns[ALGN].adj); |
| 2826 | } else { |
| 2827 | /* "<name> the <alignment> <gender> <race.adjective> <role>" */ |
| 2828 | Sprintf(qbuf, "%.20s the %.20s %.20s %.20s %.20s", |
| 2829 | svp.plname, |
| 2830 | aligns[ALGN].adj, |
| 2831 | genders[GEND].adj, |
| 2832 | races[RACE].adj, |
| 2833 | rolename); |
| 2834 | } |
| 2835 | |
| 2836 | win = create_nhwindow(NHW_MENU); |
| 2837 | if (win == WIN_ERR) |
| 2838 | panic("could not create role selection window"); |
| 2839 | start_menu(win, MENU_BEHAVE_STANDARD); |
| 2840 | |
| 2841 | add_menu_str(win, qbuf); |
| 2842 | if (maybe_skip_seps(ttyrows, aspect) != 2) |
| 2843 | add_menu_str(win, ""); |
| 2844 | return win; |
| 2845 | } |
| 2846 | |
| 2847 | #undef ROLE |
| 2848 | #undef RACE |
no test coverage detected