boulder/statue/landmine reversal and new fix

This includes a reversal of my earlier
boulder/statue/landmine fix,
and places a check for obj->where==OBJ_FLOOR into
fracture_rock().  I think this is a better approach
because:
- if eliminates the pointless extract/place in
fracture_rock, followed by extract/place in
the caller in the two places causing the crash
- it covers any similar situations that we
might have missed or that someone might add
accidentally (you might not expect the location
of an object to change inside fracture_rock())
- it allows fracturing to take place on the
other object chains if we ever need it (statues
falling down stairs, perhaps?)
- it doesn't move objects from other chains onto
the floor briefly as the current code does
This commit is contained in:
nethack.allison
2002-03-30 14:46:31 +00:00
parent 11b1874090
commit c49130e5bd
2 changed files with 10 additions and 10 deletions

View File

@@ -441,8 +441,7 @@ struct obj *obj; /* only scatter this obj */
&& rn2(10)) {
if (otmp->otyp == BOULDER) {
pline("%s apart.", Tobjnam(otmp, "break"));
fracture_rock(otmp); /* this will place fragments on floor */
obj_extract_self(otmp);
fracture_rock(otmp);
place_object(otmp, sx, sy);
if ((otmp = sobj_at(BOULDER, sx, sy)) != 0) {
/* another boulder here, restack it to the top */
@@ -455,8 +454,7 @@ struct obj *obj; /* only scatter this obj */
if ((trap = t_at(sx,sy)) && trap->ttyp == STATUE_TRAP)
deltrap(trap);
pline("%s.", Tobjnam(otmp, "crumble"));
(void) break_statue(otmp); /*this will place fragments on floor */
obj_extract_self(otmp);
(void) break_statue(otmp);
place_object(otmp, sx, sy); /* put fragments on floor */
}
used_up = TRUE;