From 3425a19dff334965e2f2d16e17b2b1615575c9a8 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Mon, 20 Oct 2008 05:18:31 +0000 Subject: [PATCH] '[' vs embedded dragon scales (trunk only) When dragon scales or dragon scale mail becomes embedded in poly'd hero's skin, the '[' command would report "you are not wearing any armor" but the '*' command showed "a set of dragon scales (embedded in your skin)". The '[' feedback is more accurate but the '*' feedback is probably more useful. This changes '[' to be more specific when lack of worn armor is accompanied by embedded dragon scales/scale mail. I put the fixes entry in the new features section since the old behavior wasn't a bug. --- doc/fixes35.0 | 1 + src/invent.c | 33 ++++++++++++++++++++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 5f79d4452..0ede291cc 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -408,6 +408,7 @@ streamline old ^X output and integrate it with enlightenment feedback; new ^X output includes expanded form of abbreviated bottom line info "killed by X" becomes "killed by a chameleon imitating X" when appropriate eating disenchanter corpses is now considered risky +make '[' command more precise when poly'd hero has embedded dragon scales/mail Platform- and/or Interface-Specific New Features diff --git a/src/invent.c b/src/invent.c index 979319c03..be9a08412 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)invent.c 3.5 2008/03/19 */ +/* SCCS Id: @(#)invent.c 3.5 2008/10/19 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -9,6 +9,7 @@ STATIC_DCL void NDECL(reorder_invent); STATIC_DCL boolean FDECL(mergable,(struct obj *,struct obj *)); +STATIC_DCL void FDECL(noarmor, (BOOLEAN_P)); STATIC_DCL void FDECL(invdisp_nothing, (const char *,const char *)); STATIC_DCL boolean FDECL(worn_wield_only, (struct obj *)); STATIC_DCL boolean FDECL(only_here, (struct obj *)); @@ -1388,7 +1389,7 @@ unsigned *resultflags; pline("Not applicable."); return 0; } else if (oc_of_sym == ARMOR_CLASS && !wearing_armor()) { - You("are not wearing any armor."); + noarmor(FALSE); return 0; } else if (oc_of_sym == WEAPON_CLASS && !uwep && !uswapwep && !uquiver) { @@ -2698,12 +2699,34 @@ doprwep() return 0; } +/* caller is responsible for checking !wearing_armor() */ +STATIC_OVL void +noarmor(report_uskin) +boolean report_uskin; +{ + if (!uskin || !report_uskin) { + You("are not wearing any armor."); + } else { + char *p, *uskinname, buf[BUFSZ]; + + uskinname = strcpy(buf, simpleonames(uskin)); + /* shorten "set of dragon scales" to " scales" + and " dragon scale mail" to " scale mail" */ + if (!strncmpi(uskinname, "set of ", 7)) uskinname += 7; + if ((p = strstri(uskinname, " dragon ")) != 0) + while ((p[1] = p[8]) != '\0') ++p; + + You("are not wearing armor but have %s embedded in your skin.", + uskinname); + } +} + int doprarm() { - if(!wearing_armor()) - You("are not wearing any armor."); - else { + if (!wearing_armor()) { + noarmor(TRUE); + } else { #ifdef TOURIST char lets[8]; #else