]> granicus.if.org Git - nethack/commitdiff
prevent possible minor MAIL abuse
authornethack.allison <nethack.allison>
Sat, 25 Mar 2006 21:06:49 +0000 (21:06 +0000)
committernethack.allison <nethack.allison>
Sat, 25 Mar 2006 21:06:49 +0000 (21:06 +0000)
<email deleted> wrote:
> * MAIL Abuse: one can polymorph into a gelatinous cube, send themselves lots of
> scrolls of mail, and eat them, gaining free nutrition.

doc/fixes35.0
src/eat.c

index becb1db13f9097f2a2a6bf7c10ba9f338f1028bc..cefb2cdaeaf6d896791d286983c72b6ca90ebac8 100644 (file)
@@ -129,6 +129,7 @@ prevent scroll of charging that has already disappeared from showing in the
 doors break instead of absorbing the blast of a broken wand of striking
 avoid "Something's in the way" message with unidentified wand of locking
 better handling for Fort Ludios and endgame in wizard mode's `^V ?' menu
+no free lunch for gelatinous cubes including scrolls of mail
 
 
 Platform- and/or Interface-Specific Fixes
index 01dca3648455d30d7611c697a3981fa1d89ebbe7..15a4174c71defe088f6883928fe07ac20537900e 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -1902,6 +1902,12 @@ eatspecial() /* called after eating non-food */
                    useupf(otmp, otmp->quan);
                return;
        }
+#ifdef MAIL
+       if (otmp->otyp == SCR_MAIL) {
+               /* no nutrition */
+               pline("This junk mail is less than satisfying.");
+       }
+#endif
        if (otmp->oclass == POTION_CLASS) {
                otmp->quan++; /* dopotion() does a useup() */
                (void)dopotion(otmp);
@@ -2179,7 +2185,7 @@ doeat()           /* generic "eat" command funtion (see cmd.c) */
 {
        register struct obj *otmp;
        int basenutrit;                 /* nutrition of full item */
-       boolean dont_start = FALSE;
+       boolean dont_start = FALSE, nodelicious = FALSE;
        
        if (Strangled) {
                pline("If you can't breathe air, how can you consume solids?");
@@ -2263,6 +2269,12 @@ doeat()          /* generic "eat" command funtion (see cmd.c) */
                basenutrit = weight(otmp);
            /* oc_nutrition is usually weight anyway */
            else basenutrit = objects[otmp->otyp].oc_nutrition;
+#ifdef MAIL
+           if (otmp->otyp == SCR_MAIL) {
+               basenutrit = 0;
+               nodelicious = TRUE;
+           }
+#endif
            context.victual.nmod = basenutrit;
            context.victual.eating = TRUE; /* needed for lesshungry() */
 
@@ -2285,7 +2297,7 @@ doeat()           /* generic "eat" command funtion (see cmd.c) */
                    losehp(rnd(15), xname(otmp), KILLED_BY_AN);
                } else
                    You("seem unaffected by the poison.");
-           } else if (!otmp->cursed)
+           } else if (!otmp->cursed && !nodelicious)
                pline("%s%s is delicious!",
                      (obj_is_pname(otmp) &&
                       (otmp->oartifact < ART_ORB_OF_DETECTION)) ? "" : "This ",