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

Function delobj_core

src/invent.c:1437–1462  ·  view source on GitHub ↗

destroy object; caller has control over whether to destroy something that ordinarily shouldn't be destroyed */

Source from the content-addressed store, hash-verified

1435/* destroy object; caller has control over whether to destroy something
1436 that ordinarily shouldn't be destroyed */
1437void
1438delobj_core(
1439 struct obj *obj,
1440 boolean force) /* 'force==TRUE' used when reviving Rider corpses */
1441{
1442 boolean update_map;
1443
1444 /* obj_resists(obj,0,0) protects the Amulet, the invocation tools,
1445 and Rider corpses */
1446 if (!force && obj_resists(obj, 0, 0)) {
1447 /* player might be doing something stupid, but we
1448 * can't guarantee that. assume special artifacts
1449 * are indestructible via drawbridges, and exploding
1450 * chests, and golem creation, and ...
1451 */
1452 obj->in_use = 0; /* in case caller has set this to 1 */
1453 return;
1454 }
1455 update_map = (obj->where == OBJ_FLOOR);
1456 obj_extract_self(obj);
1457 if (update_map) { /* floor object's coordinates are always up to date */
1458 maybe_unhide_at(obj->ox, obj->oy);
1459 newsym(obj->ox, obj->oy);
1460 }
1461 obfree(obj, (struct obj *) 0); /* frees contents also */
1462}
1463
1464/* try to find a particular type of object at designated map location */
1465struct obj *

Callers 2

delobjFunction · 0.85
reviveFunction · 0.85

Calls 5

obj_resistsFunction · 0.85
obj_extract_selfFunction · 0.85
maybe_unhide_atFunction · 0.85
newsymFunction · 0.85
obfreeFunction · 0.85

Tested by

no test coverage detected