MCPcopy Index your code
hub / github.com/NetHack/NetHack / meatbox

Function meatbox

src/mon.c:1353–1382  ·  view source on GitHub ↗

dispose of contents of an eaten container; used for pets and other mons */

Source from the content-addressed store, hash-verified

1351
1352/* dispose of contents of an eaten container; used for pets and other mons */
1353void
1354meatbox(struct monst *mon, struct obj *otmp)
1355{
1356 boolean engulf_contents = (mon->data == &mons[PM_GELATINOUS_CUBE]);
1357 int x = mon->mx, y = mon->my;
1358 struct obj *cobj;
1359
1360 if (!Has_contents(otmp) || !isok(x, y))
1361 return;
1362
1363 /* contents of eaten containers become engulfed or dropped onto
1364 the floor; this is arbitrary, but otherwise g-cubes are too
1365 powerful */
1366 if (!engulf_contents && cansee(x, y)) {
1367 pline("%s contents spill out onto the %s.",
1368 s_suffix(The(distant_name(otmp, xname))),
1369 surface(x, y));
1370 }
1371 while ((cobj = otmp->cobj) != 0) {
1372 obj_extract_self(cobj);
1373 if (otmp->otyp == ICE_BOX)
1374 removed_from_icebox(cobj);
1375 if (engulf_contents) {
1376 (void) mpickobj(mon, cobj);
1377 } else {
1378 if (!flooreffects(cobj, x, y, ""))
1379 place_object(cobj, x, y);
1380 }
1381 }
1382}
1383
1384#define mstoning(obj) \
1385 (ofood(obj) && ismnum(obj->corpsenm) \

Callers 1

m_consume_objFunction · 0.85

Calls 11

isokFunction · 0.85
s_suffixFunction · 0.85
TheFunction · 0.85
distant_nameFunction · 0.85
surfaceFunction · 0.85
obj_extract_selfFunction · 0.85
removed_from_iceboxFunction · 0.85
mpickobjFunction · 0.85
flooreffectsFunction · 0.85
place_objectFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected