mon_pmname(), obj_pmname()

Revive some code from 5 or so years ago that's been sitting in a
defunct local git branch.  There are a couple of references to
figurines having gender; the old, unfinished code did already have
support for that, the current code doesn't.  It probably won't take
much effort to add it in but I want to get this first part out of
the way.

Replace some of the
pmname(mon->data, Mgender[mon]) calls with simpler
mon_pmname(mon) and some
pmname(&mons[statue->corpsenm],
   (statue->spe & CORPSTAT_GENDER) == ... ? ... : ...) with simpler
obj_pmname(obj).  There are other instances of them which haven't
been changed but could be.
This commit is contained in:
PatR
2021-06-12 03:07:30 -07:00
parent 234eceae60
commit 57e970b227
5 changed files with 83 additions and 58 deletions

View File

@@ -3162,13 +3162,13 @@ void
selftouch(const char *arg)
{
char kbuf[BUFSZ];
const char *corpse_pmname;
if (uwep && uwep->otyp == CORPSE && touch_petrifies(&mons[uwep->corpsenm])
&& !Stone_resistance) {
pline("%s touch the %s corpse.", arg,
mons[uwep->corpsenm].pmnames[NEUTRAL]);
Sprintf(kbuf, "%s corpse",
an(mons[uwep->corpsenm].pmnames[NEUTRAL]));
corpse_pmname = obj_pmname(uwep);
pline("%s touch the %s corpse.", arg, corpse_pmname);
Sprintf(kbuf, "%s corpse", an(corpse_pmname));
instapetrify(kbuf);
/* life-saved; unwield the corpse if we can't handle it */
if (!uarmg && !Stone_resistance)
@@ -3178,10 +3178,9 @@ selftouch(const char *arg)
allow two-weapon combat when either weapon is a corpse] */
if (u.twoweap && uswapwep && uswapwep->otyp == CORPSE
&& touch_petrifies(&mons[uswapwep->corpsenm]) && !Stone_resistance) {
pline("%s touch the %s corpse.", arg,
mons[uswapwep->corpsenm].pmnames[NEUTRAL]);
Sprintf(kbuf, "%s corpse",
an(mons[uswapwep->corpsenm].pmnames[NEUTRAL]));
corpse_pmname = obj_pmname(uswapwep);
pline("%s touch the %s corpse.", arg, corpse_pmname);
Sprintf(kbuf, "%s corpse", an(corpse_pmname));
instapetrify(kbuf);
/* life-saved; unwield the corpse */
if (!uarmg && !Stone_resistance)
@@ -4715,17 +4714,17 @@ help_monster_out(
/* is it a cockatrice?... */
if (touch_petrifies(mtmp->data) && !uarmg && !Stone_resistance) {
const char *mtmp_pmname = mon_pmname(mtmp);
You("grab the trapped %s using your bare %s.",
pmname(mtmp->data, Mgender(mtmp)),
makeplural(body_part(HAND)));
mtmp_pmname, makeplural(body_part(HAND)));
if (poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM)) {
display_nhwindow(WIN_MESSAGE, FALSE);
} else {
char kbuf[BUFSZ];
Sprintf(kbuf, "trying to help %s out of a pit",
an(pmname(mtmp->data, Mgender(mtmp))));
Sprintf(kbuf, "trying to help %s out of a pit", an(mtmp_pmname));
instapetrify(kbuf);
return 1;
}