]> granicus.if.org Git - nethack/commitdiff
eating off floor while blind
authorPatR <rankin@nethack.org>
Tue, 14 Jun 2016 23:43:03 +0000 (16:43 -0700)
committerPatR <rankin@nethack.org>
Tue, 14 Jun 2016 23:43:03 +0000 (16:43 -0700)
Reported directly to devteam in late December, when blind and
lacking gloves, you could safely locate cockatrice corpses on the
floor by using 'm' prefix to move without pickup followed by 'e'
and then answering no when ask whether to eat a cockatrice corpse.

doc/fixes36.1
src/eat.c

index b6001058cde945e6c075cd40c161f4387e5562b3..ef4ec400c3034e89b875d7e74ab8b48e0ea5e39c 100644 (file)
@@ -292,6 +292,8 @@ at startup, if sysconf had been read but user's own config file couldn't be
        read, sysconf got processed again as if it contained user's options
 don't give "you cannot pass through the bars" when travel is testing possible
        paths in the vicinity of iron bars
+if blind and no gloves, using 'm<dir>' to move and then 'e' could be used to
+       locate cockatrice corpse without fatal touching (by declining to eat)
 
 
 Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository
index 5aaac8720291eecd3298aead95e1f247fc4bf421..59a33053fd51c1385333898e978d394fd24c5f24 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -3009,6 +3009,16 @@ int corpsecheck; /* 0, no check, 1, corpses, 2, tinnable corpses */
             char qsfx[QBUFSZ];
             boolean one = (otmp->quan == 1L);
 
+            /* if blind and without gloves, attempting to eat (or tin or
+               offer) a cockatrice corpse is fatal before asking whether
+               or not to use it; otherwise, 'm<dir>' followed by 'e' could
+               be used to locate cockatrice corpses without touching them */
+            if (otmp->otyp == CORPSE && will_feel_cockatrice(otmp, FALSE)) {
+                feel_cockatrice(otmp, FALSE);
+                /* if life-saved (or poly'd into stone golem), terminate
+                   attempt to eat off floor */
+                return (struct obj *) 0;
+            }
             /* "There is <an object> here; <verb> it?" or
                "There are <N objects> here; <verb> one?" */
             Sprintf(qbuf, "There %s ", otense(otmp, "are"));
@@ -3026,8 +3036,8 @@ skipfloor:
     /* We cannot use ALL_CLASSES since that causes getobj() to skip its
      * "ugly checks" and we need to check for inedible items.
      */
-    otmp =
-        getobj(feeding ? allobj : offering ? offerfodder : comestibles, verb);
+    otmp = getobj(feeding ? allobj : offering ? offerfodder : comestibles,
+                  verb);
     if (corpsecheck && otmp && !(offering && otmp->oclass == AMULET_CLASS))
         if (otmp->otyp != CORPSE || (corpsecheck == 2 && !tinnable(otmp))) {
             You_cant("%s that!", verb);