]> granicus.if.org Git - nethack/commitdiff
U409 - hiding and eating bugs
authorcohrs <cohrs>
Mon, 14 Apr 2003 01:09:30 +0000 (01:09 +0000)
committercohrs <cohrs>
Mon, 14 Apr 2003 01:09:30 +0000 (01:09 +0000)
Three related bug fixed, two reported in U409.
+ If you zapped a wand of cold downward while hiding underwater, the uundetected
flag was not reset (but the monster case was code correctly), resulting in
an impossible error on the next attack
+ If you finished eating something you were hiding under and were attacked,
another impossible would occur
+ While checking the eating gold case, I noticed that several cases would lose
gold on the floor if the attempt to eat it failed

The first case is fixed by resetting the flag just like the monster case.
The other cases are fixed by adding code to useupf to deal with this.
eatspecial and floorfood were modified to allow useupf to be called, and
fix the 3rd bug in the process.

doc/fixes34.2
src/eat.c
src/invent.c
src/zap.c

index ba187712d1eac39368cec0e1f0dd2df796d2bf2b..7b91ff752707633489380040504b71687e229a47 100644 (file)
@@ -37,6 +37,9 @@ initialize artifacts before processing $WIZKIT
 clean up inconsistency between various places quaff is documented
 is_damageable was using is_rottable incorrectly
 charge for use of an unpaid tinning kit
+avoid impossible when water freezes while hero is hiding under water
+avoid impossible after eating the object the hero is hiding under
+failed attempt to eat floor gold while polymorphed would lose the gold
 
 
 Platform- and/or Interface-Specific Fixes
index f7ed266c7019d1630a61e333f9915c6b82c7036e..03b46b7051412638a3dc32f66ae6c520c62d7ddf 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -1570,9 +1570,12 @@ eatspecial() /* called after eating non-food */
 #ifdef GOLDOBJ
                if (carried(otmp))
                    useupall(otmp);
-               else
+#else
+               if (otmp->where == OBJ_FREE)
+                   dealloc_obj(otmp);
 #endif
-               dealloc_obj(otmp);
+               else
+                   useupf(otmp, otmp->quan);
                return;
        }
        if (otmp->oclass == POTION_CLASS) {
@@ -2407,7 +2410,6 @@ floorfood(verb,corpsecheck)       /* get food from floor or pack */
                    Sprintf(qbuf, "There are %ld gold pieces here; eat them?",
                            gold->quan);
                if ((c = yn_function(qbuf, ynqchars, 'n')) == 'y') {
-                   obj_extract_self(gold);
                    return gold;
                } else if (c == 'q') {
                    return (struct obj *)0;
index 64eee699150021c14d06fd3f8619c83086d75acb..cce171291297f67d18dfeeb5648633e51ad0b8b5 100644 (file)
@@ -2507,6 +2507,7 @@ register struct obj *obj;
 long numused;
 {
        register struct obj *otmp;
+       boolean at_u = (obj->ox == u.ux && obj->oy == u.uy);
 
        /* burn_floor_paper() keeps an object pointer that it tries to
         * useupf() multiple times, so obj must survive if plural */
@@ -2520,6 +2521,8 @@ long numused;
            else (void)stolen_value(otmp, otmp->ox, otmp->oy, FALSE, FALSE);
        }
        delobj(otmp);
+       if (at_u && u.uundetected && hides_under(youmonst.data))
+           u.uundetected = OBJ_AT(u.ux, u.uy);
 }
 
 #endif /* OVLB */
index 23e992f21aaa6aaab4f516e93b2f432f0c61621a..e60efcd535d56ce21aaad195a003bdc890e3d335 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -3601,6 +3601,7 @@ boolean *shopdamage;
                        if (u.uinwater) {   /* not just `if (Underwater)' */
                            /* leave the no longer existent water */
                            u.uinwater = 0;
+                           u.uundetected = 0;
                            docrt();
                            vision_full_recalc = 1;
                        } else if (u.utrap && u.utraptype == TT_LAVA) {