"a scroll" or "scrolls"; "a silver bell" or "the Bell of Opening" */
| 2443 | |
| 2444 | /* "a scroll" or "scrolls"; "a silver bell" or "the Bell of Opening" */ |
| 2445 | char * |
| 2446 | ansimpleoname(struct obj *obj) |
| 2447 | { |
| 2448 | char *obufp, *simpleoname = simpleonames(obj); |
| 2449 | int otyp = obj->otyp; |
| 2450 | |
| 2451 | /* prefix with "the" if a unique item, or a fake one imitating same, |
| 2452 | has been formatted with its actual name (we let minimal_xname() handle |
| 2453 | any `known' and `dknown' checking necessary) */ |
| 2454 | if (otyp == FAKE_AMULET_OF_YENDOR) |
| 2455 | otyp = AMULET_OF_YENDOR; |
| 2456 | if (objects[otyp].oc_unique && OBJ_NAME(objects[otyp]) |
| 2457 | && !strcmp(simpleoname, OBJ_NAME(objects[otyp]))) { |
| 2458 | /* the() will allocate another obuf[]; we want to avoid using two */ |
| 2459 | obufp = the(simpleoname); |
| 2460 | Strcpy(simpleoname, obufp); |
| 2461 | releaseobuf(obufp); |
| 2462 | } else if (obj->quan == 1L) { |
| 2463 | /* simpleoname[] is singular if quan==1, plural otherwise; |
| 2464 | an() will allocate another obuf[]; we want to avoid using two */ |
| 2465 | obufp = an(simpleoname); |
| 2466 | Strcpy(simpleoname, obufp); |
| 2467 | releaseobuf(obufp); |
| 2468 | } |
| 2469 | return simpleoname; |
| 2470 | } |
| 2471 | |
| 2472 | /* "the scroll" or "the scrolls" */ |
| 2473 | char * |
no test coverage detected