From b53cdee210c441d70bee9cf8277ba20ff0865c18 Mon Sep 17 00:00:00 2001 From: cohrs Date: Mon, 14 Apr 2003 01:09:30 +0000 Subject: [PATCH] U409 - hiding and eating bugs 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 | 3 +++ src/eat.c | 8 +++++--- src/invent.c | 3 +++ src/zap.c | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/fixes34.2 b/doc/fixes34.2 index ba187712d..7b91ff752 100644 --- a/doc/fixes34.2 +++ b/doc/fixes34.2 @@ -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 diff --git a/src/eat.c b/src/eat.c index f7ed266c7..03b46b705 100644 --- 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; diff --git a/src/invent.c b/src/invent.c index 64eee6991..cce171291 100644 --- a/src/invent.c +++ b/src/invent.c @@ -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 */ diff --git a/src/zap.c b/src/zap.c index 23e992f21..e60efcd53 100644 --- 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) { -- 2.40.0