Replace trap with object(s). Helge Hafting */
| 5338 | |
| 5339 | /* Replace trap with object(s). Helge Hafting */ |
| 5340 | void |
| 5341 | cnv_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 */ |
| 5374 | boolean |
no test coverage detected