]> granicus.if.org Git - nethack/commitdiff
rotten food and veggie conduct
authorcohrs <cohrs>
Sun, 7 Jul 2002 05:07:53 +0000 (05:07 +0000)
committercohrs <cohrs>
Sun, 7 Jul 2002 05:07:53 +0000 (05:07 +0000)
<Someone> reported (in April) that eating cursed tripe, for example, did
not violate vegetarian conduct.  This patch moves the various conduct
checks into common code that is executed before the rotten state of food is
determined.

doc/fixes34.1
src/eat.c

index 06fb9099b394e79179ad8313d96b8ff280209da6..ec205168388c03c078cadaee479f43873ddc901b 100644 (file)
@@ -145,6 +145,7 @@ player polymorphed as rust monster would lose gold in inventory by
 no messages were printed when dowaterdemon or dowaternymph failed to create
        a monster doe to the G_GONE check
 knights should be able to avenge attacks from covetous monsters
+eating various rotten food items would not break vegan/vegetarian conduct
 
 
 Platform- and/or Interface-Specific Fixes
index 58af6659675d2078fd782f8b23bb926b79676206..90c99a57eb5fe6f01d1550b799f33a1e5294931c 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -1308,8 +1308,12 @@ start_eating(otmp)               /* called as you start to eat */
 }
 
 
+/*
+ * called on "first bite" of (non-corpse) food.
+ * used for non-rotten non-tin non-corpse food
+ */
 STATIC_OVL void
-fprefx(otmp)           /* called on "first bite" of (non-corpse) food */
+fprefx(otmp)
 struct obj *otmp;
 {
        switch(otmp->otyp) {
@@ -1388,33 +1392,6 @@ struct obj *otmp;
                      Hallucination ? "gnarly!" : "delicious!");
                break;
        }
-
-       /* KMH, conduct */
-       switch (objects[otmp->otyp].oc_material) {
-         case WAX: /* let's assume bees' wax */
-           u.uconduct.unvegan++;
-           break;
-
-         case FLESH:
-           if (otmp->otyp == EGG) {
-               u.uconduct.unvegan++;
-               break;
-           }
-         case LEATHER:
-         case BONE:
-         case DRAGON_HIDE:
-           u.uconduct.unvegan++;
-           violated_vegetarian();
-           break;
-
-         default:
-           if (otmp->otyp == PANCAKE ||
-                       otmp->otyp == FORTUNE_COOKIE || /* eggs */
-               otmp->otyp == CREAM_PIE || otmp->otyp == CANDY_BAR || /* milk */
-                       otmp->otyp == LUMP_OF_ROYAL_JELLY)
-               u.uconduct.unvegan++;
-           break;
-       }
 }
 
 STATIC_OVL void
@@ -1887,11 +1864,12 @@ doeat()         /* generic "eat" command funtion (see cmd.c) */
            victual.eating = TRUE; /* needed for lesshungry() */
 
            material = objects[otmp->otyp].oc_material;
-           if (material == LEATHER || material == BONE || material == DRAGON_HIDE) {
-                       u.uconduct.unvegan++;
-                       violated_vegetarian();
+           if (material == LEATHER ||
+               material == BONE || material == DRAGON_HIDE) {
+               u.uconduct.unvegan++;
+               violated_vegetarian();
            } else if (material == WAX)
-                       u.uconduct.unvegan++;
+               u.uconduct.unvegan++;
            u.uconduct.food++;
            
            if (otmp->cursed)
@@ -1956,6 +1934,25 @@ doeat()          /* generic "eat" command funtion (see cmd.c) */
            /* if not used up, eatcorpse sets up reqtime and may modify
             * oeaten */
        } else {
+           /* No checks for WAX, LEATHER, BONE, DRAGON_HIDE.  These are
+            * all handled in the != FOOD_CLASS case, above */
+           switch (objects[otmp->otyp].oc_material) {
+           case FLESH:
+               if (otmp->otyp == EGG) {
+                   u.uconduct.unvegan++;
+               }
+               break;
+
+           default:
+               if (otmp->otyp == PANCAKE ||
+                   otmp->otyp == FORTUNE_COOKIE || /* eggs */
+                   otmp->otyp == CREAM_PIE ||
+                   otmp->otyp == CANDY_BAR || /* milk */
+                   otmp->otyp == LUMP_OF_ROYAL_JELLY)
+                   u.uconduct.unvegan++;
+               break;
+           }
+
            victual.reqtime = objects[otmp->otyp].oc_delay;
            if (otmp->otyp != FORTUNE_COOKIE &&
                (otmp->cursed ||