diff --git a/src/hack.c b/src/hack.c index f87f672bb..e2e3e60dc 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1363,7 +1363,7 @@ domove() if (boulder) Strcpy(buf, ansimpleoname(boulder)); - else if (solid) + else if (solid && glyph_is_cmap(glyph)) Strcpy(buf, the(defsyms[glyph_to_cmap(glyph)].explanation)); else if (!Underwater) Strcpy(buf, "thin air"); diff --git a/src/objnam.c b/src/objnam.c index 3c5580c0d..afc79662d 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -10,6 +10,7 @@ #define NUMOBUF 12 STATIC_DCL char *FDECL(strprepend,(char *,const char *)); +STATIC_DCL short FDECL(rnd_otyp_by_wpnskill, (SCHAR_P)); STATIC_DCL boolean FDECL(wishymatch, (const char *,const char *,BOOLEAN_P)); STATIC_DCL char *NDECL(nextobuf); STATIC_DCL void FDECL(releaseobuf, (char *)); @@ -2277,6 +2278,27 @@ struct alt_spellings { { (const char *)0, 0 }, }; +short +rnd_otyp_by_wpnskill(skill) +schar skill; +{ + int i,n = 0; + short otyp; + for (i = bases[WEAPON_CLASS]; i < NUM_OBJECTS && objects[i].oc_class == WEAPON_CLASS; i++) + if (objects[i].oc_skill == skill) { + n++; + otyp = i; + } + if (n > 0) { + n = rn2(n); + for (i = bases[WEAPON_CLASS]; i < NUM_OBJECTS && objects[i].oc_class == WEAPON_CLASS; i++) + if (objects[i].oc_skill == skill) + if (--n < 0) return i; + } + return STRANGE_OBJECT; +} + + /* * Return something wished for. Specifying a null pointer for * the user request string results in a random object. Otherwise, @@ -3024,6 +3046,16 @@ wiztrap: } } + if (!oclass && !typ) { + if (!strncmpi(bp, "polearm", 7)) { + typ = rnd_otyp_by_wpnskill(P_POLEARMS); + goto typfnd; + } else if (!strncmpi(bp, "hammer", 6)) { + typ = rnd_otyp_by_wpnskill(P_HAMMER); + goto typfnd; + } + } + if(!oclass) return((struct obj *)0); any: if(!oclass) oclass = wrpsym[rn2((int)sizeof(wrpsym))]; diff --git a/src/pager.c b/src/pager.c index 280cf0a05..e8d7c168b 100644 --- a/src/pager.c +++ b/src/pager.c @@ -273,7 +273,8 @@ lookat(x, y, buf, monbuf) Strcpy(buf, Is_airlevel(&u.uz) ? "cloudy area" : "fog/vapor cloud"); break; default: - Strcpy(buf,defsyms[glyph_to_cmap(glyph)].explanation); + if (glyph_is_cmap(glyph)) + Strcpy(buf,defsyms[glyph_to_cmap(glyph)].explanation); break; }