]> granicus.if.org Git - nethack/commitdiff
leather spellbook
authornethack.allison <nethack.allison>
Tue, 21 Feb 2006 03:28:57 +0000 (03:28 +0000)
committernethack.allison <nethack.allison>
Tue, 21 Feb 2006 03:28:57 +0000 (03:28 +0000)
<Someone> wrote:
> * Eating a leather spellbook doesn't violate
> vegetarian conduct. I suggest you rename it to
> something else. (May I suggest "bark"?) Also, I refuse
> to consider "leather" to be a colour or texture.
> * While as a water nymph in water, seducing an unseen
> monster on dry land sometimes gives away its identity.
> * When submerged iron golem monsters residually
> "rust", and the rust damage kills them, it doesn't
> report their death.
> * Drum of Earthquake says "the entire dungeon shakes
> around you" even when you're in the Endgame or the
> Quest's top level.
> * Wishing for a statue of a guard, then destoning it,
> then chatting to it, makes it say "drop that gold"
> without context. This could probably be extended to
> other cases, too (like Croesus?)

This corrects only the first complaint in the list above.

doc/fixes34.4
src/eat.c

index cd199eb50c90e6571f0442956c18cb13a692bbb1..0cca84fff1dceebc3ba9cf332587d4a38774a495 100644 (file)
@@ -193,6 +193,7 @@ candles should not be fireproof
 monsters could end up off the left side of the Ranger quest start level
 worms don't have scales, krakens have tentacles, stalkers have a head
 you no longer "fry to a crisp" as a water elemental
+leather spellbooks violate vegetarian conduct
 
 
 Platform- and/or Interface-Specific Fixes
index 8d6dc02e7a3bd861981c6c57a91f5c8e5ecb5e75..e7dff2a558bf10dd60d6bd9f0723f10e74f76825 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -45,6 +45,7 @@ STATIC_DCL void FDECL(eataccessory, (struct obj *));
 STATIC_DCL const char *FDECL(foodword, (struct obj *));
 STATIC_DCL int FDECL(tin_variety, (struct obj *,BOOLEAN_P));
 STATIC_DCL boolean FDECL(maybe_cannibal, (int,BOOLEAN_P));
+STATIC_DCL boolean FDECL(leather_cover, (struct obj *));
 
 char msgbuf[BUFSZ];
 
@@ -2022,6 +2023,18 @@ register struct obj *otmp;
        return;
 }
 
+STATIC_OVL boolean
+leather_cover(otmp)
+struct obj *otmp;
+{
+       const char *odesc = OBJ_DESCR(objects[otmp->otyp]);
+       if (odesc && (otmp->oclass == SPBOOK_CLASS)) {
+               if (!strcmp(odesc, "leather"))
+                       return TRUE;
+       }
+       return FALSE;
+}
+
 /*
  * return 0 if the food was not dangerous.
  * return 1 if the food was dangerous and you chose to stop.
@@ -2128,6 +2141,7 @@ struct obj *otmp;
        if (!u.uconduct.unvegan &&
            ((material == LEATHER || material == BONE ||
              material == DRAGON_HIDE || material == WAX) ||
+            (leather_cover(otmp)) ||
             (cadaver && !vegan(&mons[mnum])))) {
                Sprintf(buf, "%s foul and unfamiliar to you. %s",
                        foodsmell, eat_it_anyway);
@@ -2137,6 +2151,7 @@ struct obj *otmp;
        if (!u.uconduct.unvegetarian &&
            ((material == LEATHER || material == BONE ||
              material == DRAGON_HIDE) ||
+            (leather_cover(otmp)) ||
             (cadaver && !vegetarian(&mons[mnum])))) {
                Sprintf(buf, "%s unfamiliar to you. %s",
                        foodsmell, eat_it_anyway);
@@ -2248,7 +2263,8 @@ doeat()           /* generic "eat" command funtion (see cmd.c) */
 
            material = objects[otmp->otyp].oc_material;
            if (material == LEATHER ||
-               material == BONE || material == DRAGON_HIDE) {
+               material == BONE || material == DRAGON_HIDE ||
+               leather_cover(otmp)) {
                u.uconduct.unvegan++;
                violated_vegetarian();
            } else if (material == WAX)