similar to simple_typename but minimal_xname operates on a particular object rather than its general type; it formats the most basic info: potion -- if description not known brown potion -- if oc_name_known not set potion of object detection -- if discovered */
| 1035 | potion of object detection -- if discovered |
| 1036 | */ |
| 1037 | staticfn char * |
| 1038 | minimal_xname(struct obj *obj) |
| 1039 | { |
| 1040 | char *bufp; |
| 1041 | struct obj bareobj; |
| 1042 | struct objclass saveobcls; |
| 1043 | int otyp = obj->otyp; |
| 1044 | |
| 1045 | /* suppress user-supplied name */ |
| 1046 | saveobcls.oc_uname = objects[otyp].oc_uname; |
| 1047 | objects[otyp].oc_uname = 0; |
| 1048 | /* suppress actual name if object's description is unknown */ |
| 1049 | saveobcls.oc_name_known = objects[otyp].oc_name_known; |
| 1050 | if (iflags.override_ID) |
| 1051 | objects[otyp].oc_name_known = 1; |
| 1052 | else if (!obj->dknown) |
| 1053 | objects[otyp].oc_name_known = 0; |
| 1054 | |
| 1055 | /* caveat: this makes a lot of assumptions about which fields |
| 1056 | are required in order for xname() to yield a sensible result */ |
| 1057 | bareobj = cg.zeroobj; |
| 1058 | bareobj.otyp = otyp; |
| 1059 | bareobj.oclass = obj->oclass; |
| 1060 | /* not observe_object, either the hero observed the object already or this |
| 1061 | is overriding ID and shouldn't discover the object */ |
| 1062 | bareobj.dknown = (obj->dknown || iflags.override_ID) ? 1 : 0; |
| 1063 | /* suppress known except for amulets (needed for fakes and real A-of-Y) */ |
| 1064 | bareobj.known = (obj->oclass == AMULET_CLASS) |
| 1065 | ? obj->known |
| 1066 | /* default is "on" for types which don't use it */ |
| 1067 | : !objects[otyp].oc_uses_known; |
| 1068 | bareobj.quan = 1L; /* don't want plural */ |
| 1069 | /* for a boulder, leave corpsenm as 0; non-zero produces "next boulder" */ |
| 1070 | if (otyp != BOULDER) |
| 1071 | bareobj.corpsenm = NON_PM; /* suppress statue and figurine details */ |
| 1072 | /* but suppressing fruit details leads to "bad fruit #0" |
| 1073 | [perhaps we should force "slime mold" rather than use xname?] */ |
| 1074 | if (obj->otyp == SLIME_MOLD) |
| 1075 | bareobj.spe = obj->spe; |
| 1076 | |
| 1077 | bufp = distant_name(&bareobj, xname); |
| 1078 | /* undo forced setting of bareobj.blessed for cleric (priest[ess]); |
| 1079 | bufp is an obuf[] so a pointer into the middle of that is viable */ |
| 1080 | if (!strncmp(bufp, "uncursed ", 9)) |
| 1081 | bufp += 9; |
| 1082 | |
| 1083 | objects[otyp].oc_uname = saveobcls.oc_uname; |
| 1084 | objects[otyp].oc_name_known = saveobcls.oc_name_known; |
| 1085 | return bufp; |
| 1086 | } |
| 1087 | |
| 1088 | /* xname() output augmented for multishot missile feedback */ |
| 1089 | char * |
no test coverage detected