| 6309 | } |
| 6310 | |
| 6311 | RESTORE_WARNING_FORMAT_NONLITERAL |
| 6312 | |
| 6313 | void |
| 6314 | makewish(void) |
| 6315 | { |
| 6316 | char buf[BUFSZ] = DUMMY; |
| 6317 | char bufcpy[BUFSZ], wish[BUFSZ], promptbuf[QBUFSZ]; |
| 6318 | struct obj *otmp, nothing; |
| 6319 | long maybe_LL_arti; |
| 6320 | int tries = 0; |
| 6321 | long oldwisharti = u.uconduct.wisharti; |
| 6322 | |
| 6323 | svc.context.resume_wish = 0; |
| 6324 | promptbuf[0] = '\0'; |
| 6325 | nothing = cg.zeroobj; /* lint suppression; only its address matters */ |
| 6326 | if (flags.verbose) |
| 6327 | You("may wish for an object."); |
| 6328 | retry: |
| 6329 | Strcpy(promptbuf, "For what do you wish"); |
| 6330 | if (iflags.cmdassist && tries > 0) |
| 6331 | Strcat(promptbuf, " (enter 'help' for assistance)"); |
| 6332 | Strcat(promptbuf, "?"); |
| 6333 | |
| 6334 | if (iflags.menu_requested && wish_history[0] && (tries == 0)) |
| 6335 | wish_history_menu(buf); |
| 6336 | else |
| 6337 | getlin(promptbuf, buf); |
| 6338 | |
| 6339 | if (iflags.term_gone) { |
| 6340 | if (!iflags.debug_fuzzer) |
| 6341 | svc.context.resume_wish = 1; |
| 6342 | return; |
| 6343 | } |
| 6344 | |
| 6345 | (void) mungspaces(buf); |
| 6346 | if (buf[0] == '\033') { |
| 6347 | buf[0] = '\0'; |
| 6348 | } else if (!strcmpi(buf, "help")) { |
| 6349 | wishcmdassist(MAXWISHTRY - tries); |
| 6350 | buf[0] = '\0'; /* for EDIT_GETLIN */ |
| 6351 | goto retry; |
| 6352 | } |
| 6353 | /* |
| 6354 | * Note: if they wished for and got a non-object successfully, |
| 6355 | * otmp == &hands_obj. That includes an artifact which has been |
| 6356 | * denied. Wishing for "nothing" requires a separate value to remain |
| 6357 | * distinct. |
| 6358 | */ |
| 6359 | strcpy(bufcpy, buf); |
| 6360 | otmp = readobjnam(buf, ¬hing); |
| 6361 | if (!otmp) { |
| 6362 | pline("Nothing fitting that description exists in the game."); |
| 6363 | if (++tries < MAXWISHTRY) |
| 6364 | goto retry; |
| 6365 | pline1(thats_enough_tries); |
| 6366 | otmp = readobjnam((char *) 0, (struct obj *) 0); |
| 6367 | if (!otmp) |
| 6368 | return; /* for safety; should never happen */ |
no test coverage detected