fix #K3918 - statue-to-boulder polymorph in water

'sanity_check' complains if it finds a boulder in water or lava.
Polymorphig a statue usually produces another statue but might
produce a boulder.  If done it water, keeping the boulder intact
would trigger the sanity warning.  Break it into rocks if object
polymorph produces a boulder at water or lava location.
This commit is contained in:
PatR
2023-05-08 02:07:31 -07:00
parent 210387c176
commit 3f4634211f
2 changed files with 12 additions and 6 deletions

View File

@@ -1180,6 +1180,8 @@ hangup in wizard or explore mode would result in answering ESC to "Die?"
process was probably killed without anyone knowing why it happened]
with OPTIONS=blind (blind from birth), being inflicted with timed blinding
yielded "your vision seems to dim for a moment but is normal now"
avoid sanity_check warning if statue in water or lava gets polymorphed into a
boulder; break it into a stack of rocks if that would happen
Fixes to 3.7.0-x General Problems Exposed Via git Repository

View File

@@ -1860,12 +1860,16 @@ poly_obj(struct obj *obj, int id)
}
} /* old_wornmask */
} else if (obj_location == OBJ_FLOOR) {
if (obj->otyp == BOULDER && otmp->otyp != BOULDER
&& !does_block(ox, oy, &levl[ox][oy]))
unblock_point(ox, oy);
else if (obj->otyp != BOULDER && otmp->otyp == BOULDER)
/* (checking does_block() here would be redundant) */
block_point(ox, oy);
if (obj->otyp == BOULDER && otmp->otyp != BOULDER) {
if (!does_block(ox, oy, &levl[ox][oy]))
unblock_point(ox, oy);
} else if (obj->otyp != BOULDER && otmp->otyp == BOULDER) {
/* leaving boulder in liquid would trigger sanity_check warning */
if (is_pool_or_lava(ox, oy))
fracture_rock(otmp);
if (does_block(ox, oy, &levl[ox][oy]))
block_point(ox, oy);
}
}
/* note: if otmp is gone, billing for it was handled by useup() */