MCPcopy Create free account
hub / github.com/NetHack/NetHack / do_boh_explosion

Function do_boh_explosion

src/pickup.c:2517–2534  ·  view source on GitHub ↗

Scatter most of Bag of holding contents around. Some items will be destroyed with the same chance as looting a cursed bag. */

Source from the content-addressed store, hash-verified

2515/* Scatter most of Bag of holding contents around. Some items will be
2516 destroyed with the same chance as looting a cursed bag. */
2517staticfn void
2518do_boh_explosion(struct obj *boh, boolean on_floor)
2519{
2520 struct obj *otmp, *nobj;
2521
2522 boh->in_use = 1; /* in case scatter() leads to bones creation */
2523 for (otmp = boh->cobj; otmp; otmp = nobj) {
2524 nobj = otmp->nobj;
2525 if (is_boh_item_gone()) {
2526 obj_extract_self(otmp);
2527 mbag_item_gone(!on_floor, otmp, TRUE);
2528 } else {
2529 otmp->ox = u.ux, otmp->oy = u.uy;
2530 (void) scatter(u.ux, u.uy, 4, MAY_HIT | MAY_DESTROY, otmp);
2531 }
2532 }
2533 /* boh is about to be deleted so no need to reset its in_use flag here */
2534}
2535
2536staticfn long
2537boh_loss(struct obj *container, boolean held)

Callers 2

in_containerFunction · 0.85
tipcontainerFunction · 0.85

Calls 4

is_boh_item_goneFunction · 0.85
obj_extract_selfFunction · 0.85
mbag_item_goneFunction · 0.85
scatterFunction · 0.85

Tested by

no test coverage detected