MCPcopy Create free account
hub / github.com/NetHack/NetHack / okdoor

Function okdoor

src/mklev.c:1778–1789  ·  view source on GitHub ↗

see whether it is allowable to create a door at [x,y] */

Source from the content-addressed store, hash-verified

1776
1777/* see whether it is allowable to create a door at [x,y] */
1778int
1779okdoor(coordxy x, coordxy y)
1780{
1781 boolean near_door = bydoor(x, y);
1782
1783 return ((levl[x][y].typ == HWALL || levl[x][y].typ == VWALL)
1784 && ((isok(x - 1, y) && !IS_OBSTRUCTED(levl[x - 1][y].typ))
1785 || (isok(x + 1, y) && !IS_OBSTRUCTED(levl[x + 1][y].typ))
1786 || (isok(x, y - 1) && !IS_OBSTRUCTED(levl[x][y - 1].typ))
1787 || (isok(x, y + 1) && !IS_OBSTRUCTED(levl[x][y + 1].typ)))
1788 && !near_door);
1789}
1790
1791/* do we want a secret door/corridor? */
1792boolean

Callers 2

joinFunction · 0.85
create_doorFunction · 0.85

Calls 2

bydoorFunction · 0.85
isokFunction · 0.85

Tested by

no test coverage detected