| 633 | } |
| 634 | |
| 635 | void |
| 636 | docall(struct obj *obj) |
| 637 | { |
| 638 | char buf[BUFSZ], qbuf[QBUFSZ]; |
| 639 | char **uname_p; |
| 640 | boolean had_name = FALSE; |
| 641 | |
| 642 | if (!obj->dknown) |
| 643 | return; /* probably blind; Blind || Hallucination for 'fromsink' */ |
| 644 | flush_screen(1); /* buffered updates might matter to player's response */ |
| 645 | |
| 646 | if (obj->oclass == POTION_CLASS && obj->fromsink) |
| 647 | /* fromsink: kludge, meaning it's sink water */ |
| 648 | Sprintf(qbuf, "Call a stream of %s fluid:", |
| 649 | OBJ_DESCR(objects[obj->otyp])); |
| 650 | else |
| 651 | (void) safe_qbuf(qbuf, "Call ", ":", obj, |
| 652 | docall_xname, simpleonames, "thing"); |
| 653 | /* pointer to old name */ |
| 654 | uname_p = &(objects[obj->otyp].oc_uname); |
| 655 | /* use getlin() to get a name string from the player */ |
| 656 | if (!name_from_player(buf, qbuf, *uname_p)) |
| 657 | return; |
| 658 | |
| 659 | /* clear old name */ |
| 660 | if (*uname_p) { |
| 661 | had_name = TRUE; |
| 662 | free((genericptr_t) *uname_p), *uname_p = NULL; /* clear oc_uname */ |
| 663 | } |
| 664 | |
| 665 | /* strip leading and trailing spaces; uncalls item if all spaces */ |
| 666 | (void) mungspaces(buf); |
| 667 | if (!*buf) { |
| 668 | if (had_name) /* possibly remove from disco[]; old *uname_p is gone */ |
| 669 | undiscover_object(obj->otyp); |
| 670 | } else { |
| 671 | *uname_p = dupstr(buf); |
| 672 | discover_object(obj->otyp, FALSE, TRUE, TRUE); /* possibly add to disco[] */ |
| 673 | } |
| 674 | if (obj->where == OBJ_INVENT || carrying(obj->otyp)) |
| 675 | update_inventory(); |
| 676 | } |
| 677 | |
| 678 | staticfn void |
| 679 | namefloorobj(void) |
no test coverage detected