refine "next boulder"

Guard against any other places besides minimal_xname() that set up a
fake object without being aware that for boulders the corpsenm field
should be 0 rather than NON_PM.  If that field is unexpectedly -1,
xname() will format it as ordinary "boulder" rather than producing
special "next boulder".  An explict value of 1 is now required for
the latter.
This commit is contained in:
PatR
2021-10-28 11:10:40 -07:00
parent d736cbd751
commit 3a0f1bb1aa

View File

@@ -665,7 +665,12 @@ xname_flags(
: just_an(anbuf, statue_pmname),
statue_pmname);
} else {
if (typ == BOULDER && obj->next_boulder)
/* sometimes caller wants "next boulder" rather than just
"boulder" (when pushing against a pile of more than one);
originally we just tested for non-0 but checking for 1 is
more robust because the default value for that overloaded
field (obj->corpsenm) is NON_PM (-1) rather than 0 */
if (typ == BOULDER && obj->next_boulder == 1)
Strcat(strcpy(buf, "next "), actualn);
else
Strcpy(buf, actualn);