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

Function good_rm_wall_doorpos

src/mklev.c:72–102  ·  view source on GitHub ↗

is x,y a good location for a door into room? */

Source from the content-addressed store, hash-verified

70
71/* is x,y a good location for a door into room? */
72staticfn boolean
73good_rm_wall_doorpos(coordxy x, coordxy y, int dir, struct mkroom *room)
74{
75 coordxy tx, ty;
76 int rmno;
77
78 if (!isok(x, y) || !room->needjoining)
79 return FALSE;
80
81 if (!(levl[x][y].typ == HWALL
82 || levl[x][y].typ == VWALL
83 || IS_DOOR(levl[x][y].typ)
84 || levl[x][y].typ == SDOOR))
85 return FALSE;
86
87 if (bydoor(x, y))
88 return FALSE;
89
90 tx = x + xdir[dir];
91 ty = y + ydir[dir];
92
93 if (!isok(tx,ty) || IS_OBSTRUCTED(levl[tx][ty].typ))
94 return FALSE;
95
96 rmno = (room - svr.rooms) + ROOMOFFSET;
97
98 if (rmno != (int) levl[tx][ty].roomno)
99 return FALSE;
100
101 return TRUE;
102}
103
104/* starting from x,y going towards dir, find a good location for a door */
105staticfn boolean

Callers 1

finddpos_shiftFunction · 0.85

Calls 2

isokFunction · 0.85
bydoorFunction · 0.85

Tested by

no test coverage detected