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

Function pass_two

src/mkmap.c:100–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98#define new_loc(i, j) *(gn.new_locations + ((j) * (WIDTH + 1)) + (i))
99
100staticfn void
101pass_two(schar bg_typ, schar fg_typ)
102{
103 coordxy x, y;
104 short count, dr;
105
106 for (x = 2; x <= WIDTH; x++)
107 for (y = 1; y < HEIGHT; y++) {
108 for (count = 0, dr = 0; dr < 8; dr++)
109 if (get_map(x + dirs[dr * 2], y + dirs[(dr * 2) + 1], bg_typ)
110 == fg_typ)
111 count++;
112 if (count == 5)
113 new_loc(x, y) = bg_typ;
114 else
115 new_loc(x, y) = get_map(x, y, bg_typ);
116 }
117
118 for (x = 2; x <= WIDTH; x++)
119 for (y = 1; y < HEIGHT; y++)
120 levl[x][y].typ = new_loc(x, y);
121}
122
123staticfn void
124pass_three(schar bg_typ, schar fg_typ)

Callers 1

mkmapFunction · 0.85

Calls 1

get_mapFunction · 0.85

Tested by

no test coverage detected