| 737 | }; |
| 738 | |
| 739 | staticfn void |
| 740 | makeniche(int trap_type) |
| 741 | { |
| 742 | struct mkroom *aroom; |
| 743 | struct rm *rm; |
| 744 | int dy, vct = 8; |
| 745 | coordxy xx, yy; |
| 746 | struct trap *ttmp; |
| 747 | |
| 748 | while (vct--) { |
| 749 | aroom = &svr.rooms[rn2(svn.nroom)]; |
| 750 | if (aroom->rtype != OROOM) |
| 751 | continue; /* not an ordinary room */ |
| 752 | if (aroom->doorct == 1 && rn2(5)) |
| 753 | continue; |
| 754 | if (!place_niche(aroom, &dy, &xx, &yy)) |
| 755 | continue; |
| 756 | |
| 757 | rm = &levl[xx][yy + dy]; |
| 758 | if (trap_type || !rn2(4)) { |
| 759 | rm->typ = SCORR; |
| 760 | if (trap_type) { |
| 761 | if (is_hole(trap_type) && !Can_fall_thru(&u.uz)) |
| 762 | trap_type = ROCKTRAP; |
| 763 | ttmp = maketrap(xx, yy + dy, trap_type); |
| 764 | if (ttmp) { |
| 765 | if (trap_type != ROCKTRAP) |
| 766 | ttmp->once = 1; |
| 767 | if (trap_engravings[trap_type]) { |
| 768 | make_engr_at(xx, yy - dy, |
| 769 | trap_engravings[trap_type], NULL, 0L, |
| 770 | DUST); |
| 771 | wipe_engr_at(xx, yy - dy, 5, |
| 772 | FALSE); /* age it a little */ |
| 773 | } |
| 774 | } |
| 775 | } |
| 776 | dosdoor(xx, yy, aroom, SDOOR); |
| 777 | } else { |
| 778 | rm->typ = CORR; |
| 779 | if (rn2(7)) { |
| 780 | dosdoor(xx, yy, aroom, rn2(5) ? SDOOR : DOOR); |
| 781 | } else { |
| 782 | /* inaccessible niches occasionally have iron bars */ |
| 783 | if (!rn2(5) && IS_WALL(levl[xx][yy].typ)) { |
| 784 | (void) set_levltyp(xx, yy, IRONBARS); |
| 785 | if (rn2(3)) |
| 786 | (void) mkcorpstat(CORPSE, (struct monst *) 0, |
| 787 | mkclass(S_HUMAN, 0), xx, |
| 788 | yy + dy, TRUE); |
| 789 | } |
| 790 | if (!svl.level.flags.noteleport) |
| 791 | (void) mksobj_at(SCR_TELEPORTATION, xx, yy + dy, TRUE, |
| 792 | FALSE); |
| 793 | if (!rn2(3)) |
| 794 | (void) mkobj_at(RANDOM_CLASS, xx, yy + dy, TRUE); |
| 795 | } |
| 796 | } |
no test coverage detected