corpse_xname overhaul (trunk only)

Extend the capabilities of corpse_xname() so that various callers can
be simplified.  It can how handle an article prefix, effectively turning it
into corpse_doname() (not quite; still need doname() to see a count when
quantity is more than one, or to see bless/curse state).  It can also handle
inclusion of adjectives like "partly eaten" or "bite-covered".  For unique
monsters those come out in the form
  the Chromatic Dragon's partly eaten corpse
instead of the old
  partly eaten Chromatic Dragon corpse
[so wishing probably needs to be taught about potentially finding a monster
name before assorted adjectives such as blessed; also, name_to_mon() needs
to learn how to cope with the possessive suffix].

     A sizeable chunk of this patch deals with consolidating some of the
redundant "petrified by a cockatrice corpse" handling.  It may be possible
to consolidate all remaining instances together since they're quite similar,
but I didn't think about that until just now and I want to get this patch
over with.
This commit is contained in:
nethack.rankin
2005-12-30 06:08:20 +00:00
parent bd3a5466dd
commit 40dd607233
13 changed files with 208 additions and 178 deletions

View File

@@ -1486,28 +1486,29 @@ struct obj *corpse;
struct monst *mtmp, *mcarry;
boolean is_uwep, chewed;
xchar where;
char *cname, cname_buf[BUFSZ];
char cname[BUFSZ];
struct obj *container = (struct obj *)0;
int container_where = 0;
where = corpse->where;
is_uwep = corpse == uwep;
cname = eos(strcpy(cname_buf, "bite-covered "));
Strcpy(cname, corpse_xname(corpse, TRUE));
is_uwep = (corpse == uwep);
chewed = (corpse->oeaten != 0);
Strcpy(cname, corpse_xname(corpse,
chewed ? "bite-covered" : (const char *)0,
CXN_SINGULAR));
mcarry = (where == OBJ_MINVENT) ? corpse->ocarry : 0;
if (where == OBJ_CONTAINED) {
struct monst *mtmp2 = (struct monst *)0;
struct monst *mtmp2;
container = corpse->ocontainer;
mtmp2 = get_container_location(container, &container_where, (int *)0);
mtmp2 = get_container_location(container, &container_where, (int *)0);
/* container_where is the outermost container's location even if nested */
if (container_where == OBJ_MINVENT && mtmp2) mcarry = mtmp2;
}
mtmp = revive(corpse, FALSE); /* corpse is gone if successful */
if (mtmp) {
chewed = (mtmp->mhp < mtmp->mhpmax);
if (chewed) cname = cname_buf; /* include "bite-covered" prefix */
switch (where) {
case OBJ_INVENT:
if (is_uwep)