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

Function openone

src/detect.c:1728–1788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1726}
1727
1728staticfn void
1729openone(coordxy zx, coordxy zy, genericptr_t num)
1730{
1731 struct trap *ttmp;
1732 struct obj *otmp;
1733 int *num_p = (int *) num;
1734
1735 if (OBJ_AT(zx, zy)) {
1736 for (otmp = svl.level.objects[zx][zy]; otmp; otmp = otmp->nexthere) {
1737 if (Is_box(otmp) && otmp->olocked) {
1738 otmp->olocked = 0;
1739 (*num_p)++;
1740 }
1741 }
1742 /* let it fall to the next cases. could be on trap. */
1743 }
1744 /* note: secret doors can't be trapped; they use levl[][].wall_info;
1745 see rm.h for the troublesome overlay of doormask and wall_info */
1746 if (levl[zx][zy].typ == SDOOR
1747 || (levl[zx][zy].typ == DOOR
1748 && (levl[zx][zy].doormask & (D_CLOSED | D_LOCKED)))) {
1749 if (levl[zx][zy].typ == SDOOR)
1750 cvt_sdoor_to_door(&levl[zx][zy]); /* .typ = DOOR */
1751 if (levl[zx][zy].doormask & D_TRAPPED) {
1752 if (distu(zx, zy) < 3)
1753 b_trapped("door", NO_PART);
1754 else
1755 Norep("You %s an explosion!",
1756 cansee(zx, zy) ? "see" : (!Deaf ? "hear"
1757 : "feel the shock of"));
1758 wake_nearto(zx, zy, 11 * 11);
1759 levl[zx][zy].doormask = D_NODOOR;
1760 } else
1761 levl[zx][zy].doormask = D_ISOPEN;
1762 unblock_point(zx, zy);
1763 newsym(zx, zy);
1764 (*num_p)++;
1765 } else if (levl[zx][zy].typ == SCORR) {
1766 levl[zx][zy].typ = CORR;
1767 unblock_point(zx, zy);
1768 newsym(zx, zy);
1769 (*num_p)++;
1770 } else if ((ttmp = t_at(zx, zy)) != 0) {
1771 struct monst *mon;
1772 boolean dummy; /* unneeded "you notice it arg" */
1773
1774 if (!ttmp->tseen && ttmp->ttyp != STATUE_TRAP) {
1775 ttmp->tseen = 1;
1776 newsym(zx, zy);
1777 (*num_p)++;
1778 }
1779 mon = u_at(zx, zy) ? &gy.youmonst : m_at(zx, zy);
1780 if (openholdingtrap(mon, &dummy)
1781 || openfallingtrap(mon, TRUE, &dummy))
1782 (*num_p)++;
1783 } else if (find_drawbridge(&zx, &zy)) {
1784 /* make sure it isn't an open drawbridge */
1785 open_drawbridge(zx, zy);

Callers

nothing calls this directly

Calls 11

cvt_sdoor_to_doorFunction · 0.85
b_trappedFunction · 0.85
NorepFunction · 0.85
wake_neartoFunction · 0.85
unblock_pointFunction · 0.85
newsymFunction · 0.85
t_atFunction · 0.85
openholdingtrapFunction · 0.85
openfallingtrapFunction · 0.85
find_drawbridgeFunction · 0.85
open_drawbridgeFunction · 0.85

Tested by

no test coverage detected