From e8dc88c95023f3e1f615f14074051e8832acc592 Mon Sep 17 00:00:00 2001 From: cohrs Date: Sun, 7 Jul 2002 05:07:53 +0000 Subject: [PATCH] rotten food and veggie conduct 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 | 1 + src/eat.c | 61 ++++++++++++++++++++++++--------------------------- 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/doc/fixes34.1 b/doc/fixes34.1 index 06fb9099b..ec2051683 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -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 diff --git a/src/eat.c b/src/eat.c index 58af66596..90c99a57e 100644 --- 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 || -- 2.40.0