| 578 | } |
| 579 | |
| 580 | staticfn char * |
| 581 | xname_flags( |
| 582 | struct obj *obj, |
| 583 | unsigned cxn_flags) /* bitmask of CXN_xxx values */ |
| 584 | { |
| 585 | char *buf; |
| 586 | char *obufp, *buf_end, *buf_eos; |
| 587 | size_t bufspaceleft; |
| 588 | int typ = obj->otyp; |
| 589 | struct objclass *ocl = &objects[typ]; |
| 590 | int nn = ocl->oc_name_known, omndx = obj->corpsenm; |
| 591 | const char *actualn = OBJ_NAME(*ocl); |
| 592 | const char *dn = OBJ_DESCR(*ocl); |
| 593 | const char *un = ocl->oc_uname; |
| 594 | boolean pluralize = (obj->quan != 1L) && !(cxn_flags & CXN_SINGULAR); |
| 595 | boolean known, dknown, bknown; |
| 596 | |
| 597 | gx.xnamep = nextobuf(); |
| 598 | /* set up primary work buffer; the first 'PREFIX' bytes are set |
| 599 | aside for use by doname() */ |
| 600 | buf = gx.xnamep + PREFIX; /* leave room for "17 -3 " */ |
| 601 | buf_end = gx.xnamep + BUFSZ - 1; /* last byte within the obuf[] */ |
| 602 | buf[0] = '\0'; |
| 603 | ConcUpdate(buf); /* set buf_eos and bufspaceleft */ |
| 604 | |
| 605 | if (Role_if(PM_SAMURAI)) { |
| 606 | actualn = Japanese_item_name(typ, actualn); |
| 607 | if (typ == WOODEN_HARP || typ == MAGIC_HARP) |
| 608 | dn = "koto"; |
| 609 | } |
| 610 | /* generic items don't have an actual-name; we shouldn't ever be called |
| 611 | for those; pacify static analyzer without resorting to impossible() */ |
| 612 | if (!actualn) |
| 613 | actualn = (typ > 0 && typ < MAXOCLASSES) ? "generic" : "object?"; |
| 614 | /* 3.6.2: this used to be part of 'dn's initialization, but it |
| 615 | needs to come after possibly overriding 'actualn' */ |
| 616 | if (!dn) |
| 617 | dn = actualn; |
| 618 | |
| 619 | /* |
| 620 | * clean up known when it's tied to oc_name_known, eg after AD_DRIN |
| 621 | * This is only required for unique objects since the article |
| 622 | * printed for the object is tied to the combination of the two |
| 623 | * and printing the wrong article gives away information. |
| 624 | */ |
| 625 | if (!nn && ocl->oc_uses_known && ocl->oc_unique) |
| 626 | obj->known = 0; |
| 627 | if (!Blind && !gd.distantname) |
| 628 | observe_object(obj); |
| 629 | if (Role_if(PM_CLERIC)) |
| 630 | obj->bknown = 1; /* avoid set_bknown() to bypass update_inventory() */ |
| 631 | |
| 632 | if (iflags.override_ID) { |
| 633 | known = dknown = bknown = TRUE; |
| 634 | nn = 1; |
| 635 | } else { |
| 636 | known = obj->known; |
| 637 | dknown = obj->dknown; |
no test coverage detected