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

Function rot_corpse

src/dig.c:2145–2189  ·  view source on GitHub ↗

* Called when a corpse has rotted completely away. */

Source from the content-addressed store, hash-verified

2143 * Called when a corpse has rotted completely away.
2144 */
2145void
2146rot_corpse(anything *arg, long timeout)
2147{
2148 coordxy x = 0, y = 0;
2149 struct obj *obj = arg->a_obj;
2150 boolean on_floor = obj->where == OBJ_FLOOR,
2151 in_invent = obj->where == OBJ_INVENT;
2152
2153 if (on_floor) {
2154 x = obj->ox;
2155 y = obj->oy;
2156 } else if (in_invent) {
2157 if (flags.verbose) {
2158 char *cname = corpse_xname(obj, (const char *) 0, CXN_NO_PFX);
2159
2160 Your("%s%s %s away%c", obj == uwep ? "wielded " : "", cname,
2161 otense(obj, "rot"), obj == uwep ? '!' : '.');
2162 }
2163 if (obj->owornmask) {
2164 remove_worn_item(obj, TRUE);
2165 stop_occupation();
2166 }
2167 } else if (obj->where == OBJ_MINVENT) {
2168 if (obj->owornmask && obj == MON_WEP(obj->ocarry))
2169 setmnotwielded(obj->ocarry, obj); /* clears owornmask */
2170 } else if (obj->where == OBJ_MIGRATING) {
2171 /* clear destination flag so that obfree()'s check for
2172 freeing a worn object doesn't get a false hit */
2173 obj->owornmask = 0L;
2174 }
2175 rot_organic(arg, timeout);
2176 if (on_floor) {
2177 struct monst *mtmp = m_at(x, y);
2178
2179 /* a hiding monster may be exposed */
2180 if (mtmp && !OBJ_AT(x, y) && mtmp->mundetected
2181 && hides_under(mtmp->data)) {
2182 mtmp->mundetected = 0;
2183 } else if (u_at(x, y)
2184 && u.uundetected && hides_under(gy.youmonst.data))
2185 (void) hideunder(&gy.youmonst);
2186 newsym(x, y);
2187 } else if (in_invent)
2188 update_inventory();
2189}
2190
2191#if 0
2192void

Callers 1

zombify_monFunction · 0.85

Calls 10

corpse_xnameFunction · 0.85
YourFunction · 0.85
otenseFunction · 0.85
remove_worn_itemFunction · 0.85
stop_occupationFunction · 0.85
setmnotwieldedFunction · 0.85
rot_organicFunction · 0.85
hideunderFunction · 0.85
newsymFunction · 0.85
update_inventoryFunction · 0.85

Tested by

no test coverage detected