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.
This commit is contained in:
cohrs
2003-04-14 01:09:30 +00:00
parent 86253d5602
commit b53cdee210
4 changed files with 12 additions and 3 deletions

View 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

View File

@@ -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;

View 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 */

View File

@@ -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) {