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

Function trapped_door_at

src/detect.c:181–197  ·  view source on GitHub ↗

this is checking whether a trap symbol represents a trapped door, not whether the door here is actually trapped */

Source from the content-addressed store, hash-verified

179/* this is checking whether a trap symbol represents a trapped door,
180 not whether the door here is actually trapped */
181boolean
182trapped_door_at(int ttyp, coordxy x, coordxy y)
183{
184 struct rm *lev;
185
186 if (!glyph_is_trap(glyph_at(x, y)))
187 return FALSE;
188 if (ttyp != TRAPPED_DOOR || (Hallucination && rn2(20)))
189 return FALSE;
190 lev = &levl[x][y];
191 if (!IS_DOOR(lev->typ))
192 return FALSE;
193 if ((lev->doormask & (D_NODOOR | D_BROKEN | D_ISOPEN)) != 0
194 && trapped_chest_at(ttyp, x, y))
195 return FALSE;
196 return TRUE;
197}
198
199/* recursively search obj for an object in class oclass, return 1st found */
200struct obj *

Callers 2

trap_descriptionFunction · 0.85
doidtrapFunction · 0.85

Calls 3

glyph_atFunction · 0.85
rn2Function · 0.85
trapped_chest_atFunction · 0.85

Tested by

no test coverage detected