format a corpse name (xname() omits monster type; doname() calls us); eatcorpse() also uses us for death reason when eating tainted glob */
| 1821 | /* format a corpse name (xname() omits monster type; doname() calls us); |
| 1822 | eatcorpse() also uses us for death reason when eating tainted glob */ |
| 1823 | char * |
| 1824 | corpse_xname( |
| 1825 | struct obj *otmp, |
| 1826 | const char *adjective, |
| 1827 | unsigned cxn_flags) /* bitmask of CXN_xxx values */ |
| 1828 | { |
| 1829 | char *nambuf; |
| 1830 | int omndx = otmp->corpsenm; |
| 1831 | boolean ignore_quan = (cxn_flags & CXN_SINGULAR) != 0, |
| 1832 | /* suppress "the" from "the unique monster corpse" */ |
| 1833 | no_prefix = (cxn_flags & CXN_NO_PFX) != 0, |
| 1834 | /* include "the" for "the woodchuck corpse */ |
| 1835 | the_prefix = (cxn_flags & CXN_PFX_THE) != 0, |
| 1836 | /* include "an" for "an ogre corpse */ |
| 1837 | any_prefix = (cxn_flags & CXN_ARTICLE) != 0, |
| 1838 | /* leave off suffix (do_name() appends "corpse" itself) */ |
| 1839 | omit_corpse = (cxn_flags & CXN_NOCORPSE) != 0, |
| 1840 | possessive = FALSE, |
| 1841 | glob = (otmp->otyp != CORPSE && otmp->globby); |
| 1842 | const char *mnam; |
| 1843 | |
| 1844 | /* some callers [aobjnam()] rely on prefix area that xname() sets aside */ |
| 1845 | gx.xnamep = nextobuf(); |
| 1846 | nambuf = gx.xnamep + PREFIX; |
| 1847 | |
| 1848 | if (glob) { |
| 1849 | mnam = OBJ_NAME(objects[otmp->otyp]); /* "glob of <monster>" */ |
| 1850 | } else if (omndx == NON_PM) { /* paranoia */ |
| 1851 | mnam = "thing"; |
| 1852 | } else { |
| 1853 | mnam = obj_pmname(otmp); |
| 1854 | if (the_unique_pm(&mons[omndx]) || type_is_pname(&mons[omndx])) { |
| 1855 | mnam = s_suffix(mnam); |
| 1856 | possessive = TRUE; |
| 1857 | /* don't precede personal name like "Medusa" with an article */ |
| 1858 | if (type_is_pname(&mons[omndx])) |
| 1859 | no_prefix = TRUE; |
| 1860 | /* always precede non-personal unique monster name like |
| 1861 | "Oracle" with "the" unless explicitly overridden */ |
| 1862 | else if (the_unique_pm(&mons[omndx]) && !no_prefix) |
| 1863 | the_prefix = TRUE; |
| 1864 | } |
| 1865 | } |
| 1866 | if (no_prefix) |
| 1867 | the_prefix = any_prefix = FALSE; |
| 1868 | else if (the_prefix) |
| 1869 | any_prefix = FALSE; /* mutually exclusive */ |
| 1870 | |
| 1871 | *nambuf = '\0'; |
| 1872 | /* can't use the() the way we use an() below because any capitalized |
| 1873 | Name causes it to assume a personal name and return Name as-is; |
| 1874 | that's usually the behavior wanted, but here we need to force "the" |
| 1875 | to precede capitalized unique monsters (pnames are handled above) */ |
| 1876 | if (the_prefix) |
| 1877 | Strcat(nambuf, "the "); |
| 1878 | /* note: over time, various instances of the(mon_name()) have crept |
| 1879 | into the code, so the() has been modified to deal with capitalized |
| 1880 | monster names; we could switch to using it below like an() */ |
no test coverage detected