move items from a gap in a shop's wall that is being repaired; litter[] guarantees that items will end up inside shkp's shop, but if the wall being repaired is shared by two shops the items might have started in the other shop */
| 4619 | if the wall being repaired is shared by two shops the items might |
| 4620 | have started in the other shop */ |
| 4621 | staticfn void |
| 4622 | litter_scatter( |
| 4623 | uint8 *litter, |
| 4624 | coordxy x, coordxy y, |
| 4625 | struct monst *shkp) |
| 4626 | { |
| 4627 | struct obj *otmp; |
| 4628 | |
| 4629 | /* placement below assumes there is always at least one adjacent spot |
| 4630 | that's inside the shop; caller guarantees that */ |
| 4631 | { |
| 4632 | /* Scatter objects haphazardly into the shop */ |
| 4633 | if (Punished && !u.uswallow |
| 4634 | && ((uchain->ox == x && uchain->oy == y) |
| 4635 | || (uball->where == OBJ_FLOOR |
| 4636 | && uball->ox == x && uball->oy == y))) { |
| 4637 | /* |
| 4638 | * Either the ball or chain is in the repair location. |
| 4639 | * Take the easy way out and put ball&chain under hero. |
| 4640 | * |
| 4641 | * FIXME: message should be reworded; this might be the |
| 4642 | * shop's doorway rather than a wall, there might be some |
| 4643 | * other stuff here which isn't junk, and "your junk" has |
| 4644 | * a slang connotation which could be applicable if hero |
| 4645 | * has Passes_walls ability. |
| 4646 | */ |
| 4647 | if (!Deaf && !muteshk(shkp)) { |
| 4648 | SetVoice(shkp, 0, 80, 0); |
| 4649 | verbalize("Get your junk out of my wall!"); |
| 4650 | } |
| 4651 | unplacebc(); /* pick 'em up */ |
| 4652 | placebc(); /* put 'em down */ |
| 4653 | } |
| 4654 | while ((otmp = svl.level.objects[x][y]) != 0) { |
| 4655 | /* Don't mess w/ boulders -- just merge into wall */ |
| 4656 | if (otmp->otyp == BOULDER || otmp->otyp == ROCK) { |
| 4657 | obj_extract_self(otmp); |
| 4658 | obfree(otmp, (struct obj *) 0); |
| 4659 | } else { |
| 4660 | int trylimit = 10; |
| 4661 | int i = rn2(9), ix, iy; |
| 4662 | |
| 4663 | /* otmp must be moved otherwise svl.level.objects[x][y] will |
| 4664 | never become Null and while-loop won't terminate */ |
| 4665 | do { |
| 4666 | i = (i + 1) % 9; |
| 4667 | } while (--trylimit && !(litter[i] & LITTER_INSHOP)); |
| 4668 | if ((litter[i] & (LITTER_OPEN | LITTER_INSHOP)) != 0) { |
| 4669 | ix = x + horiz(i); |
| 4670 | iy = y + vert(i); |
| 4671 | } else { |
| 4672 | /* we know shk isn't at <x,y> because repair |
| 4673 | is deferred in that situation */ |
| 4674 | ix = shkp->mx; |
| 4675 | iy = shkp->my; |
| 4676 | } |
| 4677 | /* if the wall being repaired is shared by two adjacent |
| 4678 | shops, <ix,iy> might be in a different shop than the |
no test coverage detected