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

Function discard_minvent

src/mkobj.c:2524–2536  ·  view source on GitHub ↗

throw away all of a monster's inventory */

Source from the content-addressed store, hash-verified

2522
2523/* throw away all of a monster's inventory */
2524void
2525discard_minvent(struct monst *mtmp, boolean uncreate_artifacts)
2526{
2527 struct obj *otmp;
2528
2529 while ((otmp = mtmp->minvent) != 0) {
2530 /* this has now become very similar to m_useupall()... */
2531 extract_from_minvent(mtmp, otmp, TRUE, TRUE);
2532 if (uncreate_artifacts && otmp->oartifact)
2533 artifact_exists(otmp, safe_oname(otmp), FALSE, ONAME_NO_FLAGS);
2534 obfree(otmp, (struct obj *) 0); /* dealloc_obj() isn't sufficient */
2535 }
2536}
2537
2538/*
2539 * Free obj from whatever list it is on in preparation for deleting it

Callers 5

discard_migrationsFunction · 0.85
mongoneFunction · 0.85
makemonFunction · 0.85
unmakemonFunction · 0.85
create_monsterFunction · 0.85

Calls 4

extract_from_minventFunction · 0.85
artifact_existsFunction · 0.85
safe_onameFunction · 0.85
obfreeFunction · 0.85

Tested by

no test coverage detected