move objects from fobj/nexthere lists to buriedobjlist, keeping position information */
| 1981 | /* move objects from fobj/nexthere lists to buriedobjlist, keeping position |
| 1982 | information */ |
| 1983 | struct obj * |
| 1984 | bury_an_obj(struct obj *otmp, boolean *dealloced) |
| 1985 | { |
| 1986 | struct obj *otmp2; |
| 1987 | boolean under_ice; |
| 1988 | |
| 1989 | debugpline1("bury_an_obj: %s", xname(otmp)); |
| 1990 | if (dealloced) |
| 1991 | *dealloced = FALSE; |
| 1992 | if (otmp == uball) { |
| 1993 | unpunish(); |
| 1994 | set_utrap((unsigned) rn1(50, 20), TT_BURIEDBALL); |
| 1995 | pline_The("iron ball gets buried!"); |
| 1996 | } |
| 1997 | /* after unpunish(), or might get deallocated chain */ |
| 1998 | otmp2 = otmp->nexthere; |
| 1999 | /* |
| 2000 | * obj_resists(,0,0) prevents Rider corpses from being buried. |
| 2001 | * It also prevents The Amulet and invocation tools from being |
| 2002 | * buried. Since they can't be confined to bags and statues, |
| 2003 | * it makes sense that they can't be buried either, even though |
| 2004 | * the real reason there (direct accessibility when carried) is |
| 2005 | * completely different. |
| 2006 | */ |
| 2007 | if (otmp == uchain || obj_resists(otmp, 0, 0)) |
| 2008 | return otmp2; |
| 2009 | |
| 2010 | if (otmp->otyp == LEASH && otmp->leashmon != 0) |
| 2011 | o_unleash(otmp); |
| 2012 | |
| 2013 | if (otmp->lamplit && otmp->otyp != POT_OIL) |
| 2014 | end_burn(otmp, TRUE); |
| 2015 | |
| 2016 | obj_extract_self(otmp); |
| 2017 | |
| 2018 | under_ice = is_ice(otmp->ox, otmp->oy); |
| 2019 | if ((otmp->otyp == ROCK && !under_ice) || otmp->otyp == BOULDER) { |
| 2020 | /* merges into burying material; boulder removal is for #wizbury */ |
| 2021 | if (dealloced) |
| 2022 | *dealloced = TRUE; |
| 2023 | obfree(otmp, (struct obj *) 0); |
| 2024 | return otmp2; |
| 2025 | } |
| 2026 | /* |
| 2027 | * Start a rot on organic material. Not corpses -- they |
| 2028 | * are already handled. |
| 2029 | */ |
| 2030 | if (otmp->otyp == CORPSE) { |
| 2031 | ; /* should cancel timer if under_ice */ |
| 2032 | } else if ((under_ice ? (otmp->oclass == POTION_CLASS) : is_organic(otmp)) |
| 2033 | && !obj_resists(otmp, 5, 95)) { |
| 2034 | (void) start_timer((under_ice ? 0L : 250L) + (long) rnd(250), |
| 2035 | TIMER_OBJECT, ROT_ORGANIC, obj_to_any(otmp)); |
| 2036 | #if 0 |
| 2037 | /* rusting of buried metal not yet implemented */ |
| 2038 | } else if (is_rustprone(otmp)) { |
| 2039 | (void) start_timer((long) rnd((otmp->otyp == HEAVY_IRON_BALL) |
| 2040 | ? 1500 |
no test coverage detected