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

Function bad_location

src/mkmaze.c:340–351  ·  view source on GitHub ↗

* Bad if: * pos is occupied OR * pos is inside restricted region (nlx,nly,nhx,nhy) OR * NOT (pos is corridor and a maze level OR pos is a room OR pos is air) */

Source from the content-addressed store, hash-verified

338 * NOT (pos is corridor and a maze level OR pos is a room OR pos is air)
339 */
340boolean
341bad_location(
342 coordxy x, coordxy y,
343 coordxy nlx, coordxy nly, coordxy nhx, coordxy nhy)
344{
345 return (boolean) (occupied(x, y)
346 || within_bounded_area(x, y, nlx, nly, nhx, nhy)
347 || !((levl[x][y].typ == CORR
348 && svl.level.flags.is_maze_lev)
349 || levl[x][y].typ == ROOM
350 || levl[x][y].typ == AIR));
351}
352
353/* pick a location in area (lx, ly, hx, hy) but not in (nlx, nly, nhx, nhy)
354 and place something (based on rtype) in that region */

Callers 1

put_lregion_hereFunction · 0.85

Calls 1

occupiedFunction · 0.85

Tested by

no test coverage detected