| 324 | } |
| 325 | |
| 326 | DISABLE_WARNING_FORMAT_NONLITERAL |
| 327 | |
| 328 | /* the #read command; read a scroll or spell book or various other things */ |
| 329 | int |
| 330 | doread(void) |
| 331 | { |
| 332 | static const char find_any_braille[] = "feel any Braille writing."; |
| 333 | struct obj *scroll; |
| 334 | boolean confused, nodisappear; |
| 335 | int otyp; |
| 336 | |
| 337 | /* |
| 338 | * Reading while blind is allowed in most cases, including the |
| 339 | * Book of the Dead but not regular spellbooks. For scrolls, the |
| 340 | * description has to have been seen or magically learned (so only |
| 341 | * when scroll->dknown is true): hero recites the label while |
| 342 | * holding the unfurled scroll. We deliberately don't require |
| 343 | * free hands because that would cripple scroll of remove curse, |
| 344 | * but we ought to be requiring hands or at least limbs. The |
| 345 | * recitation could be sub-vocal; actual speech isn't required. |
| 346 | * |
| 347 | * Reading while confused is allowed and can produce alternate |
| 348 | * outcome. |
| 349 | * |
| 350 | * Reading while stunned is currently allowed but probably should |
| 351 | * be prevented.... |
| 352 | */ |
| 353 | |
| 354 | gk.known = FALSE; |
| 355 | if (check_capacity((char *) 0)) |
| 356 | return ECMD_OK; |
| 357 | |
| 358 | scroll = getobj("read", read_ok, GETOBJ_PROMPT); |
| 359 | if (!scroll) |
| 360 | return ECMD_CANCEL; |
| 361 | otyp = scroll->otyp; |
| 362 | scroll->pickup_prev = 0; /* no longer 'just picked up' */ |
| 363 | |
| 364 | /* outrumor has its own blindness check */ |
| 365 | if (otyp == FORTUNE_COOKIE) { |
| 366 | if (flags.verbose) |
| 367 | You("break up the cookie and throw away the pieces."); |
| 368 | outrumor(bcsign(scroll), BY_COOKIE); |
| 369 | if (!Blind) |
| 370 | if (!u.uconduct.literate++) |
| 371 | livelog_printf(LL_CONDUCT, |
| 372 | "became literate by reading a fortune cookie"); |
| 373 | useup(scroll); |
| 374 | return ECMD_TIME; |
| 375 | } else if (otyp == T_SHIRT || otyp == ALCHEMY_SMOCK |
| 376 | || otyp == HAWAIIAN_SHIRT) { |
| 377 | char buf[BUFSZ], *mesg; |
| 378 | const char *endpunct; |
| 379 | |
| 380 | if (Blind) { |
| 381 | You_cant(find_any_braille); |
| 382 | return ECMD_OK; |
| 383 | } |
nothing calls this directly
no test coverage detected