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

Function rot_organic

src/dig.c:2124–2140  ·  view source on GitHub ↗

* The organic material has rotted away while buried. As an expansion, * we could add partial damage. A damage count is kept in the object * and every time we are called we increment the count and reschedule another * timeout. Eventually the object rots away. * * This is used by buried objects other than corpses. When a container rots * away, any contents become newly buried objects. */

Source from the content-addressed store, hash-verified

2122 */
2123/* ARGSUSED */
2124void
2125rot_organic(anything *arg, long timeout UNUSED)
2126{
2127 struct obj *obj = arg->a_obj;
2128
2129 while (Has_contents(obj)) {
2130 /* We don't need to place contained object on the floor
2131 first, but we do need to update its map coordinates. */
2132 obj->cobj->ox = obj->ox, obj->cobj->oy = obj->oy;
2133 /* Everything which can be held in a container can also be
2134 buried, so bury_an_obj's use of obj_extract_self insures
2135 that Has_contents(obj) will eventually become false. */
2136 (void) bury_an_obj(obj->cobj, (boolean *) 0);
2137 }
2138 obj_extract_self(obj);
2139 obfree(obj, (struct obj *) 0);
2140}
2141
2142/*
2143 * Called when a corpse has rotted completely away.

Callers 1

rot_corpseFunction · 0.85

Calls 3

bury_an_objFunction · 0.85
obj_extract_selfFunction · 0.85
obfreeFunction · 0.85

Tested by

no test coverage detected