player or missile impacts location, causing objects to fall down */
| 1508 | |
| 1509 | /* player or missile impacts location, causing objects to fall down */ |
| 1510 | void |
| 1511 | impact_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 */ |
no test coverage detected