From 3a0f1bb1aa7f59b8fab8538de5193f5d454414a5 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 28 Oct 2021 11:10:40 -0700 Subject: [PATCH] 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. --- src/objnam.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/objnam.c b/src/objnam.c index 76a21170d..8e4784031 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -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);