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

Function cnv_trap_obj

src/trap.c:5340–5371  ·  view source on GitHub ↗

Replace trap with object(s). Helge Hafting */

Source from the content-addressed store, hash-verified

5338
5339/* Replace trap with object(s). Helge Hafting */
5340void
5341cnv_trap_obj(
5342 int otyp,
5343 int cnt,
5344 struct trap *ttmp,
5345 boolean bury_it)
5346{
5347 struct obj *otmp = mksobj(otyp, TRUE, FALSE);
5348 struct monst *mtmp;
5349
5350 otmp->quan = cnt;
5351 otmp->owt = weight(otmp);
5352 /* Only dart traps are capable of being poisonous */
5353 if (otyp != DART)
5354 otmp->opoisoned = 0;
5355 place_object(otmp, ttmp->tx, ttmp->ty);
5356 if (bury_it) {
5357 /* magical digging first disarms this trap, then will unearth it */
5358 (void) bury_an_obj(otmp, (boolean *) 0);
5359 } else {
5360 /* Sell your own traps only... */
5361 if (ttmp->madeby_u)
5362 sellobj(otmp, ttmp->tx, ttmp->ty);
5363 stackobj(otmp);
5364 }
5365 newsym(ttmp->tx, ttmp->ty);
5366 if (u.utrap && u_at(ttmp->tx, ttmp->ty))
5367 reset_utrap(TRUE);
5368 if (((mtmp = m_at(ttmp->tx, ttmp->ty)) != 0) && mtmp->mtrapped)
5369 mtmp->mtrapped = 0;
5370 deltrap(ttmp);
5371}
5372
5373/* whether moving to a trap location is moving "into" the trap or "onto" it */
5374boolean

Callers 5

digholeFunction · 0.85
disarm_holdingtrapFunction · 0.85
disarm_landmineFunction · 0.85
disarm_shooting_trapFunction · 0.85
trap_ice_effectsFunction · 0.85

Calls 9

mksobjFunction · 0.85
weightFunction · 0.85
place_objectFunction · 0.85
bury_an_objFunction · 0.85
sellobjFunction · 0.85
stackobjFunction · 0.85
newsymFunction · 0.85
reset_utrapFunction · 0.85
deltrapFunction · 0.85

Tested by

no test coverage detected