MCPcopy Index your code
hub / github.com/NetHack/NetHack / impact_drop

Function impact_drop

src/dokick.c:1510–1632  ·  view source on GitHub ↗

player or missile impacts location, causing objects to fall down */

Source from the content-addressed store, hash-verified

1508
1509/* player or missile impacts location, causing objects to fall down */
1510void
1511impact_drop(
1512 struct obj *missile, /* caused impact, won't drop itself */
1513 coordxy x, coordxy y, /* location affected */
1514 xint16 dlev) /* if !0 send to dlev near player */
1515{
1516 schar toloc;
1517 struct obj *obj, *obj2;
1518 struct monst *shkp;
1519 long oct, dct, price, debit, robbed;
1520 boolean angry, costly, isrock;
1521 coord cc;
1522
1523 if (!OBJ_AT(x, y))
1524 return;
1525
1526 toloc = down_gate(x, y);
1527 drop_to(&cc, toloc, x, y);
1528 if (!cc.y)
1529 return;
1530
1531 if (dlev) {
1532 /* send objects next to player falling through trap door.
1533 * checked in obj_delivery().
1534 */
1535 toloc = MIGR_WITH_HERO;
1536 cc.y = dlev;
1537 }
1538
1539 costly = costly_spot(x, y);
1540 price = debit = robbed = 0L;
1541 angry = FALSE;
1542 shkp = (struct monst *) 0;
1543 /* if 'costly', we must keep a record of ESHK(shkp) before
1544 * it undergoes changes through the calls to stolen_value.
1545 * the angry bit must be reset, if needed, in this fn, since
1546 * stolen_value is called under the 'silent' flag to avoid
1547 * unsavory pline repetitions.
1548 */
1549 if (costly) {
1550 if ((shkp = shop_keeper(*in_rooms(x, y, SHOPBASE))) != 0) {
1551 debit = ESHK(shkp)->debit;
1552 robbed = ESHK(shkp)->robbed;
1553 angry = !shkp->mpeaceful;
1554 }
1555 }
1556
1557 isrock = (missile && missile->otyp == ROCK);
1558 oct = dct = 0L;
1559 for (obj = svl.level.objects[x][y]; obj; obj = obj2) {
1560 obj2 = obj->nexthere;
1561 if (obj == missile)
1562 continue;
1563 /* number of objects in the pile */
1564 oct += obj->quan;
1565 if (obj == uball || obj == uchain)
1566 continue;
1567 /* boulders can fall too, but rarely & never due to rocks */

Callers 4

goto_levelFunction · 0.85
digactualholeFunction · 0.85
fall_throughFunction · 0.85
ship_objectFunction · 0.85

Calls 15

down_gateFunction · 0.85
drop_toFunction · 0.85
costly_spotFunction · 0.85
shop_keeperFunction · 0.85
in_roomsFunction · 0.85
rn2Function · 0.85
obj_extract_selfFunction · 0.85
stolen_valueFunction · 0.85
picked_containerFunction · 0.85
add_to_migrationFunction · 0.85
YouFunction · 0.85
currencyFunction · 0.85

Tested by

no test coverage detected