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

Function stuck_in_wall

src/pray.c:160–181  ·  view source on GitHub ↗

return True if surrounded by impassible rock, regardless of the state of your own location (for example, inside a doorless closet) */

Source from the content-addressed store, hash-verified

158/* return True if surrounded by impassible rock, regardless of the state
159 of your own location (for example, inside a doorless closet) */
160boolean
161stuck_in_wall(void)
162{
163 int i, j, x, y, count = 0;
164
165 if (Passes_walls)
166 return FALSE;
167 for (i = -1; i <= 1; i++) {
168 x = u.ux + i;
169 for (j = -1; j <= 1; j++) {
170 if (!i && !j)
171 continue;
172 y = u.uy + j;
173 if (!isok(x, y)
174 || (IS_OBSTRUCTED(levl[x][y].typ)
175 && (levl[x][y].typ != SDOOR && levl[x][y].typ != SCORR))
176 || (blocked_boulder(i, j) && !throws_rocks(gy.youmonst.data)))
177 ++count;
178 }
179 }
180 return (count == 8) ? TRUE : FALSE;
181}
182
183/*
184 * Return 0 if nothing particular seems wrong, positive numbers for

Callers 2

nh_timeoutFunction · 0.85
in_troubleFunction · 0.85

Calls 2

isokFunction · 0.85
blocked_boulderFunction · 0.85

Tested by

no test coverage detected