hats vs helms

Something from <Someone>'s list:  some messages have hardcoded references
to "helmet" which sound strange when the character is wearing a hat or cap.
helm_simple_name() is comparable to the existing cloak_simple_name().  It
returns "helm" or "hat" depending upon whether the helmet provides the
same protection that yields the assorted repetitions of "fortunately,
you are wearing a hard helmet".  This choice ends up categorizing elven
leather helm as a hat (which I think is ok given that its undiscovered
description is "leather hat"), contrary to <Someone>'s suggestion that the
distinction be made based on whether the helmet was made of cloth.

     I started on this a year and a half ago but didn't commit it.
Unfortunately I don't remember why and haven't done any significant
additional work now--just recovered from some intervening bit rot and
confirmed that the patch as is seems to be working ok (in the trunk; the
branch side has not been tested).  I suspect that I meant to look for
additional helmet messages which could benefit from conditional headgear
description.  (Those "hard helmet" ones don't need it, although they
should perhaps be moved into a common routine instead of being replicated.)
This commit is contained in:
nethack.rankin
2004-11-13 04:00:52 +00:00
parent 88dad9386b
commit 7672a2c60b
10 changed files with 67 additions and 27 deletions
+10 -5
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)do_wear.c 3.4 2004/10/29 */
/* SCCS Id: @(#)do_wear.c 3.4 2004/11/11 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1180,7 +1180,10 @@ register struct obj *otmp;
if(delay) {
nomul(delay);
if (is_helmet(otmp)) {
nomovemsg = "You finish taking off your helmet.";
/* ick... */
nomovemsg = !strcmp(helm_simple_name(otmp), "hat") ?
"You finish taking off your hat." :
"You finish taking off your helmet.";
afternmv = Helmet_off;
}
else if (is_gloves(otmp)) {
@@ -1282,13 +1285,14 @@ boolean noisy;
if (is_helmet(otmp)) {
if (uarmh) {
if (noisy) already_wearing(an(c_helmet));
if (noisy) already_wearing(an(helm_simple_name(uarmh)));
err++;
} else if (Upolyd && has_horns(youmonst.data) && !is_flimsy(otmp)) {
/* (flimsy exception matches polyself handling) */
if (noisy)
pline_The("%s won't fit over your horn%s.",
c_helmet, plur(num_horns(youmonst.data)));
helm_simple_name(otmp),
plur(num_horns(youmonst.data)));
err++;
} else
*mask = W_ARMH;
@@ -2146,7 +2150,8 @@ register struct obj *atmp;
#endif
} else if (DESTROY_ARM(uarmh)) {
if (donning(otmp)) cancel_don();
Your("helmet turns to dust and is blown away!");
Your("%s turns to dust and is blown away!",
helm_simple_name(uarmh));
(void) Helmet_off();
useup(otmp);
} else if (DESTROY_ARM(uarmg)) {