guts of tty's player_selection() */
| 2203 | |
| 2204 | /* guts of tty's player_selection() */ |
| 2205 | int |
| 2206 | genl_player_setup(int screenheight) |
| 2207 | { |
| 2208 | char pbuf[QBUFSZ]; |
| 2209 | anything any; |
| 2210 | int i, k, n, choice, nextpick; |
| 2211 | boolean getconfirmation, picksomething; |
| 2212 | winid win = WIN_ERR; |
| 2213 | menu_item *selected = 0; |
| 2214 | int clr = NO_COLOR; |
| 2215 | char pick4u = 'n'; |
| 2216 | int result = 0; /* assume failure (player chooses to 'quit') */ |
| 2217 | |
| 2218 | program_state.in_role_selection++; /* affects tty menu cleanup */ |
| 2219 | /* Used to avoid "Is this ok?" if player has already specified all |
| 2220 | * four facets of role. |
| 2221 | * Note that rigid_role_checks might force any unspecified facets to |
| 2222 | * have a specific value, but that will still require confirmation; |
| 2223 | * player can specify the forced ones if avoiding that is demanded. |
| 2224 | */ |
| 2225 | picksomething = (ROLE == ROLE_NONE || RACE == ROLE_NONE |
| 2226 | || GEND == ROLE_NONE || ALGN == ROLE_NONE); |
| 2227 | /* Used for '-@'; |
| 2228 | * choose randomly without asking for all unspecified facets. |
| 2229 | */ |
| 2230 | if (flags.randomall && picksomething) { |
| 2231 | if (ROLE == ROLE_NONE) |
| 2232 | ROLE = ROLE_RANDOM; |
| 2233 | if (RACE == ROLE_NONE) |
| 2234 | RACE = ROLE_RANDOM; |
| 2235 | if (GEND == ROLE_NONE) |
| 2236 | GEND = ROLE_RANDOM; |
| 2237 | if (ALGN == ROLE_NONE) |
| 2238 | ALGN = ROLE_RANDOM; |
| 2239 | } |
| 2240 | |
| 2241 | /* prevent unnecessary prompting if role forces race (samurai) or gender |
| 2242 | (valkyrie) or alignment (rogue), or race forces alignment (orc), &c */ |
| 2243 | rigid_role_checks(); |
| 2244 | |
| 2245 | if (ROLE == ROLE_NONE || RACE == ROLE_NONE |
| 2246 | || GEND == ROLE_NONE || ALGN == ROLE_NONE) { |
| 2247 | char *prompt = build_plselection_prompt(pbuf, QBUFSZ, |
| 2248 | ROLE, RACE, GEND, ALGN); |
| 2249 | /* prompt[] contains "Shall I pick ... for you? [ynaq] " |
| 2250 | y - game picks role,&c then asks player to confirm; |
| 2251 | n - player manually chooses via menu selections; |
| 2252 | a - like 'y', but skips confirmation and starts game; |
| 2253 | q - quit |
| 2254 | */ |
| 2255 | #if 1 |
| 2256 | trimspaces(prompt); /* 'prompt' is constructed with trailing space */ |
| 2257 | /* accept any character and do validation ourselves so that we can |
| 2258 | shorten prompt; it will be "Shall I pick ... for you? [ynaq] " |
| 2259 | with final space appended by yn_function() [for tty at least] */ |
| 2260 | do { |
| 2261 | pick4u = yn_function(prompt, (char *) 0, '\0', FALSE); |
| 2262 | pick4u = lowc(pick4u); |
no test coverage detected