splattered oil fix
splatter_burning_oil() is called when a lit potion of oil gets broken, and it can dish out fatal damage to the hero. An earlier fix to prevent a light-source panic (thrown item is not on any of the object lists) during bones creation didn't address leaving that lit potion intact if it was on the floor (which can happen if the breakage is caused by striking or force bolt rather than its being thrown or kicked). Use the existing obj->in_use mechanism as a more general fix, after teaching bones code that it applies to other things besides the hero's inventory.
This commit is contained in:
10
src/bones.c
10
src/bones.c
@@ -57,11 +57,17 @@ resetobjs(ochain,restore)
|
||||
struct obj *ochain;
|
||||
boolean restore;
|
||||
{
|
||||
struct obj *otmp;
|
||||
struct obj *otmp, *nobj;
|
||||
|
||||
for (otmp = ochain; otmp; otmp = otmp->nobj) {
|
||||
for (otmp = ochain; otmp; otmp = nobj) {
|
||||
nobj = otmp->nobj;
|
||||
if (otmp->cobj)
|
||||
resetobjs(otmp->cobj,restore);
|
||||
if (otmp->in_use) {
|
||||
obj_extract_self(otmp);
|
||||
dealloc_obj(otmp);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (restore) {
|
||||
/* artifact bookeeping needs to be done during
|
||||
|
||||
@@ -1650,15 +1650,8 @@ boolean from_invent;
|
||||
change_luck(-2);
|
||||
break;
|
||||
case POT_WATER: /* really, all potions */
|
||||
obj->in_use = 1; /* in case it's fatal */
|
||||
if (obj->otyp == POT_OIL && obj->lamplit) {
|
||||
/* splatter_burning_oil() could kill hero,
|
||||
and a timed obj with obj->where==0
|
||||
causes a problem during savebones() so
|
||||
get rid of the timer/lightsources on it now */
|
||||
if (obj->timed)
|
||||
obj_stop_timers(obj);
|
||||
if (obj_sheds_light(obj))
|
||||
del_light_source(LS_OBJECT, obj_to_any(obj));
|
||||
splatter_burning_oil(x,y);
|
||||
} else if (distu(x,y) <= 2) {
|
||||
if (!breathless(youmonst.data) || haseyes(youmonst.data)) {
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
#define FIRST_AMULET AMULET_OF_ESP
|
||||
#define LAST_AMULET AMULET_OF_YENDOR
|
||||
|
||||
extern struct obj *thrownobj; /* dothrow.c */
|
||||
extern struct obj *kickobj; /* dokick.c */
|
||||
|
||||
struct valuable_data { long count; int typ; };
|
||||
|
||||
static struct valuable_data
|
||||
@@ -650,6 +653,10 @@ die:
|
||||
/* might have been killed while using a disposable item, so make sure
|
||||
it's gone prior to inventory disclosure and creation of bones data */
|
||||
inven_inuse(TRUE);
|
||||
/* not on object lists; if an active light source, would cause big
|
||||
trouble (`obj_is_local' panic) for savebones() -> savelev() */
|
||||
if (thrownobj) dealloc_obj(thrownobj);
|
||||
if (kickobj) dealloc_obj(kickobj);
|
||||
|
||||
/* Sometimes you die on the first move. Life's not fair.
|
||||
* On those rare occasions you get hosed immediately, go out
|
||||
|
||||
Reference in New Issue
Block a user