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

Function maze1xy

src/sp_lev.c:2899–2916  ·  view source on GitHub ↗

* Select a random coordinate in the maze. * * We want a place not 'touched' by the loader. That is, a place in * the maze outside every part of the special level. */

Source from the content-addressed store, hash-verified

2897 * the maze outside every part of the special level.
2898 */
2899staticfn void
2900maze1xy(coord *m, int humidity)
2901{
2902 int x, y, tryct = 2000;
2903 /* tryct: normally it won't take more than ten or so tries due
2904 to the circumstances under which we'll be called, but the
2905 `humidity' screening might drastically change the chances */
2906
2907 do {
2908 x = rn1(gx.x_maze_max - 3, 3);
2909 y = rn1(gy.y_maze_max - 3, 3);
2910 if (--tryct < 0)
2911 break; /* give up */
2912 } while (!(x % 2) || !(y % 2) || SpLev_Map[x][y]
2913 || !is_ok_location((coordxy) x, (coordxy) y, humidity));
2914
2915 m->x = (coordxy) x, m->y = (coordxy) y;
2916}
2917
2918/*
2919 * If there's a significant portion of maze unused by the special level,

Callers 1

fill_empty_mazeFunction · 0.85

Calls 1

is_ok_locationFunction · 0.85

Tested by

no test coverage detected